From 70bfd3bcc18d5545b5988fdc08a4ea830b349676 Mon Sep 17 00:00:00 2001 From: Peter WONG Date: Mon, 19 Aug 2013 12:59:29 +0800 Subject: [PATCH 1/2] Update dynamic_form_modification.rst --- cookbook/form/dynamic_form_modification.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index cd608ac9d0d..7920c5e4760 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -407,6 +407,12 @@ The meetup is passed as an entity hidden field to the form. So we can access eac sport like this:: // src/Acme/DemoBundle/Form/Type/SportMeetupType.php + namespace Acme\DemoBundle\Form\Type; + + use Symfony\Component\Form\FormBuilderInterface; + use Symfony\Component\Form\FormEvents; + use Symfony\Component\Form\FormEvent; + class SportMeetupType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) @@ -419,7 +425,7 @@ sport like this:: $builder->addEventListener( FormEvents::PRE_SET_DATA, - function(FormEvent $event) use($factory){ + function(FormEvent $event) use ($factory){ $form = $event->getForm(); // this would be your entity, i.e. SportMeetup @@ -532,7 +538,7 @@ The subscriber would now look like:: ->find($id); if ($meetup === null) { - $msg = 'The event %s could not be found for you registration'; + $msg = 'The event %s could not be found for your registration'; throw new \Exception(sprintf($msg, $id)); } $form = $event->getForm(); From 58120017d5baa289517c36a33dff2da3f01e782c Mon Sep 17 00:00:00 2001 From: Peter WONG Date: Mon, 19 Aug 2013 19:20:25 +0800 Subject: [PATCH 2/2] swap use statement to sort alphabetically --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 7920c5e4760..819dce2d7a6 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -410,8 +410,8 @@ sport like this:: namespace Acme\DemoBundle\Form\Type; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvent; + use Symfony\Component\Form\FormEvents; class SportMeetupType extends AbstractType {