Skip to content

Update form documents examples #11563

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
May 17, 2019
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
16 changes: 8 additions & 8 deletions form/form_collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ objects::

Then, create a form class so that a ``Tag`` object can be modified by the user::

// src/AppBundle/Form/Type/TagType.php
namespace AppBundle\Form\Type;
// src/AppBundle/Form/TagType.php
namespace AppBundle\Form;

use AppBundle\Entity\Tag;
use Symfony\Component\Form\AbstractType;
Expand Down Expand Up @@ -114,8 +114,8 @@ form itself, create a form for the ``Task`` class.
Notice that you embed a collection of ``TagType`` forms using the
:doc:`CollectionType </reference/forms/types/collection>` field::

// src/AppBundle/Form/Type/TaskType.php
namespace AppBundle\Form\Type;
// src/AppBundle/Form/TaskType.php
namespace AppBundle\Form;

use AppBundle\Entity\Task;
use Symfony\Component\Form\AbstractType;
Expand Down Expand Up @@ -150,7 +150,7 @@ In your controller, you'll create a new form from the ``TaskType``::

use AppBundle\Entity\Tag;
use AppBundle\Entity\Task;
use AppBundle\Form\Type\TaskType;
use AppBundle\Form\TaskType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

Expand Down Expand Up @@ -254,7 +254,7 @@ type expects to receive exactly two, otherwise an error will be thrown:
``This form should not contain extra fields``. To make this flexible,
add the ``allow_add`` option to your collection field::

// src/AppBundle/Form/Type/TaskType.php
// src/AppBundle/Form/TaskType.php

// ...
use Symfony\Component\Form\FormBuilderInterface;
Expand Down Expand Up @@ -419,7 +419,7 @@ for the tags in the ``Task`` class::

Next, add a ``by_reference`` option to the ``tags`` field and set it to ``false``::

// src/AppBundle/Form/Type/TaskType.php
// src/AppBundle/Form/TaskType.php

// ...
public function buildForm(FormBuilderInterface $builder, array $options)
Expand Down Expand Up @@ -551,7 +551,7 @@ The solution is similar to allowing tags to be added.

Start by adding the ``allow_delete`` option in the form Type::

// src/AppBundle/Form/Type/TaskType.php
// src/AppBundle/Form/TaskType.php

// ...
public function buildForm(FormBuilderInterface $builder, array $options)
Expand Down