8000 Completely re-reading the data transformers chapter by weaverryan · Pull Request #5456 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Completely re-reading the data transformers chapter #5456

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 6 commits into from
Jul 8, 2015
Merged
Changes from 1 commit
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
Prev Previous commit
Adding an example of how the other format for attaching transformers …
…looks
  • Loading branch information
weaverryan committed Jul 8, 2015
commit 0762848fa4ae0c658d9fefc1c2981f528a699be7
8 changes: 8 additions & 0 deletions cookbook/form/data_transformers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ in your code.
:class:`Symfony\\Component\\Form\\DataTransformerInterface` - so you can create
your own classes, instead of putting all the logic in the form (see the next section).

You can also add the transformer, right when adding the field by changing the format
slightly::

$builder->add(
$builder->create('description', 'textarea')
->addModelTransformer(...)
);

Harder Example: Transforming an Issue Number into an Issue Entity
-----------------------------------------------------------------

Expand Down
0