@@ -271,7 +271,7 @@ method of the ``FormFactory``::
271271
272272 $form = $formFactory->createBuilder()
273273 ->add('username', TextType::class)
274- ->add('show_email ', CheckboxType::class)
274+ ->add('showEmail ', CheckboxType::class)
275275 ->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
276276 $user = $event->getData();
277277 $form = $event->getForm();
@@ -283,7 +283,7 @@ method of the ``FormFactory``::
283283 // checks whether the user has chosen to display their email or not.
284284 // If the data was submitted previously, the additional value that is
285285 // included in the request variables needs to be removed.
286- if (true === $user['show_email ']) {
286+ if (true === $user['showEmail ']) {
287287 $form->add('email', EmailType::class);
288288 } else {
289289 unset($user['email']);
@@ -312,7 +312,7 @@ callback for better readability::
312312 {
313313 $builder
314314 ->add('username', TextType::class)
315- ->add('show_email ', CheckboxType::class)
315+ ->add('showEmail ', CheckboxType::class)
316316 ->addEventListener(
317317 FormEvents::PRE_SET_DATA,
318318 [$this, 'onPreSetData']
@@ -379,7 +379,7 @@ Consider the following example of a form event subscriber::
379379 // checks whether the user has chosen to display their email or not.
380380 // If the data was submitted previously, the additional value that
381381 // is included in the request variables needs to be removed.
382- if (true === $user['show_email ']) {
382+ if (true === $user['showEmail ']) {
383383 $form->add('email', EmailType::class);
384384 } else {
385385 unset($user['email']);
@@ -398,7 +398,7 @@ To register the event subscriber, use the ``addEventSubscriber()`` method::
398398
399399 $form = $formFactory->createBuilder()
400400 ->add('username', TextType::class)
401- ->add('show_email ', CheckboxType::class)
401+ ->add('showEmail ', CheckboxType::class)
402402 ->addEventSubscriber(new AddEmailFieldListener())
403403 ->getForm();
404404
0 commit comments