Skip to content

Commit 54b0381

Browse files
committed
Merge branch '3.4' into 4.3
* 3.4: Removed sidebar about Statefull data mappers
2 parents 99589f0 + 9cfc826 commit 54b0381

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

form/data_mappers.rst

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -193,30 +193,3 @@ create a new ``Color`` object now.
193193

194194
When a form has the ``inherit_data`` option set to ``true``, it does not use the data mapper and
195195
lets its parent map inner values.
196-
197-
.. sidebar:: Stateful Data Mappers
198-
199-
Sometimes, data mappers need to access services or need to maintain their
200-
state. In this case, you cannot implement the methods in the form type
201-
itself. Create a separate class implementing ``DataMapperInterface`` and
202-
initialize it in your form type::
203-
204-
// src/Form/Type/ColorType.php
205-
206-
// ...
207-
use App\Form\DataMapper\ColorMapper;
208-
209-
final class ColorType extends AbstractType
210-
{
211-
public function buildForm(FormBuilderInterface $builder, array $options)
212-
{
213-
$builder
214-
// ...
215-
216-
// Initialize the data mapper class and e.g. pass some state
217-
->setDataMapper(new ColorMapper($options['opacity']))
218-
;
219-
}
220-
221-
// ...
222-
}

0 commit comments

Comments
 (0)