Skip to content

Update data_transformers.rst #8316

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
Sep 1, 2017
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
10 changes: 5 additions & 5 deletions form/data_transformers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Simple Example: Transforming String Tags from User Input to an Array

Suppose you have a Task form with a tags ``text`` type::

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

use AppBundle\Entity\Task;
Expand Down Expand Up @@ -55,7 +55,7 @@ This is a *perfect* time to attach a custom data transformer to the ``tags``
field. The easiest way to do this is with the :class:`Symfony\\Component\\Form\\CallbackTransformer`
class::

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

use Symfony\Component\Form\CallbackTransformer;
Expand Down Expand Up @@ -116,7 +116,7 @@ issue number.

Start by setting up the text field like normal::

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

use AppBundle\Entity\Task;
Expand Down Expand Up @@ -247,7 +247,7 @@ of the entity manager (because ``IssueToNumberTransformer`` needs this).
No problem! Just add a ``__construct()`` function to ``TaskType`` and force this
to be passed in. Then, you can easily create and add the transformer::

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

use AppBundle\Form\DataTransformer\IssueToNumberTransformer;
Expand Down Expand Up @@ -418,7 +418,7 @@ it's recognized as a custom field type:
Now, whenever you need to use your special ``issue_selector`` field type,
it's quite easy::

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

use AppBundle\Form\DataTransformer\IssueToNumberTransformer;
Expand Down