Skip to content

Commit 170914b

Browse files
luiges90weaverryan
authored andcommitted
Update dynamic_form_modification.rst
1 parent 7594167 commit 170914b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cookbook/form/dynamic_form_modification.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,12 @@ The meetup is passed as an entity hidden field to the form. So we can access eac
407407
sport like this::
408408

409409
// src/Acme/DemoBundle/Form/Type/SportMeetupType.php
410+
namespace Acme\DemoBundle\Form\Type;
411+
412+
use Symfony\Component\Form\FormBuilderInterface;
413+
use Symfony\Component\Form\FormEvents;
414+
use Symfony\Component\Form\FormEvent;
415+
410416
class SportMeetupType extends AbstractType
411417
{
412418
public function buildForm(FormBuilderInterface $builder, array $options)
@@ -419,7 +425,7 @@ sport like this::
419425

420426
$builder->addEventListener(
421427
FormEvents::PRE_SET_DATA,
422-
function(FormEvent $event) use($factory){
428+
function(FormEvent $event) use ($factory){
423429
$form = $event->getForm();
424430

425431
// this would be your entity, i.e. SportMeetup
@@ -528,7 +534,7 @@ The subscriber would now look like::
528534
->find($id);
529535

530536
if ($meetup === null) {
531-
$msg = 'The event %s could not be found for you registration';
537+
$msg = 'The event %s could not be found for your registration';
532538
throw new \Exception(sprintf($msg, $id));
533539
}
534540
$form = $event->getForm();

0 commit comments

Comments
 (0)