php - Edit customer creation in Sylius
I want to edit the creation of a customer, I want to add a field during the creation. During the creation the service "sylius.controller.customer:createAction" is called insecurity.yml
sylius_shop_register:
path: /register
methods: [GET, POST]
defaults:
_controller: sylius.controller.customer:createAction
_sylius:
template: "@SyliusShop/register.html.twig"
form: Sylius\Bundle\CoreBundle\Form\Type\Customer\CustomerRegistrationType
event: register
redirect:
route: sylius_shop_account_dashboard
flash: sylius.customer.register
However I checked a lot of Sylius services I didn't find it. How can I access to this service to custom the creation ?
Thanks for your time.
Answer
Solution:
You should customize the form and not the controler. You can find detailed information here (sylius customizing form)
The idea is:
Create a form extension:
Register this extension as a service in the
AppBundle/Resources/config/services.yml
Add according translations, and add a new template to show your new field
Regards