Skip to content

Commit

Permalink
Fix PSR coding standards error
Browse files Browse the repository at this point in the history
  • Loading branch information
ifdattic committed Mar 21, 2014
1 parent 868de1e commit da2ee60
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cookbook/form/dynamic_form_modification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand All @@ -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();

Expand Down Expand Up @@ -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
});
}
Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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();

Expand All @@ -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();
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit da2ee60

Please sign in to comment.