From da2ee60c71d8bc9c67b1e4b052d6e14277bd350f Mon Sep 17 00:00:00 2001 From: Andrew M Date: Mon, 10 Mar 2014 18:43:35 +0200 Subject: [PATCH] Fix PSR coding standards error --- cookbook/form/dynamic_form_modification.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 2add7ddd759..8a35f45bdac 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -99,7 +99,7 @@ creating that particular field is delegated to an event listener:: { $builder->add('price'); - $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { // ... adding the name field if needed }); } @@ -116,7 +116,7 @@ the event listener might look like the following:: public function buildForm(FormBuilderInterface $builder, array $options) { // ... - $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { $product = $event->getData(); $form = $event->getForm(); @@ -254,7 +254,7 @@ Using an event listener, your form might look like this:: ->add('subject', 'text') ->add('body', 'textarea') ; - $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { // ... add a choice list of friends of the current application user }); } @@ -330,13 +330,13 @@ and fill in the listener logic:: $builder->addEventListener( FormEvents::PRE_SET_DATA, - function(FormEvent $event) use ($user) { + function (FormEvent $event) use ($user) { $form = $event->getForm(); $formOptions = array( 'class' => 'Acme\DemoBundle\Entity\User', 'property' => 'fullName', - 'query_builder' => function(EntityRepository $er) use ($user) { + 'query_builder' => function (EntityRepository $er) use ($user) { // build a custom query // return $er->createQueryBuilder('u')->addOrderBy('fullName', 'DESC'); @@ -496,7 +496,7 @@ sport like this:: $builder->addEventListener( FormEvents::PRE_SET_DATA, - function(FormEvent $event) { + function (FormEvent $event) { $form = $event->getForm(); // this would be your entity, i.e. SportMeetup @@ -565,7 +565,7 @@ The type would now look like:: )); ; - $formModifier = function(FormInterface $form, Sport $sport = null) { + $formModifier = function (FormInterface $form, Sport $sport = null) { $positions = null === $sport ? array() : $sport->getAvailablePositions(); $form->add('position', 'entity', array( @@ -577,7 +577,7 @@ The type would now look like:: $builder->addEventListener( FormEvents::PRE_SET_DATA, - function(FormEvent $event) use ($formModifier) { + function (FormEvent $event) use ($formModifier) { // this would be your entity, i.e. SportMeetup $data = $event->getData(); @@ -587,7 +587,7 @@ The type would now look like:: $builder->get('sport')->addEventListener( FormEvents::POST_SUBMIT, - function(FormEvent $event) use ($formModifier) { + function (FormEvent $event) use ($formModifier) { // It's important here to fetch $event->getForm()->getData(), as // $event->getData() will get you the client data (that is, the ID) $sport = $event->getForm()->getData(); @@ -739,7 +739,7 @@ all of this, use a listener:: public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->addEventListener(FormEvents::POST_SUBMIT, function($event) { + $builder->addEventListener(FormEvents::POST_SUBMIT, function ($event) { $event->stopPropagation(); }, 900); // Always set a higher priority than ValidationListener