8000 Fix PSR coding standards error by ifdattic · Pull Request #3658 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Fix PSR coding standards error #3658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
});
}
10000 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