Skip to content

Commit 6e05fe7

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: Update dynamic_form_modification.rst Minor tweaks [Serializer] Update serializer.rst
2 parents e8bbb5b + 572533f commit 6e05fe7

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

form/dynamic_form_modification.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ For better reusability or if there is some heavy logic in your event listener,
138138
you can also move the logic for creating the ``name`` field to an
139139
:ref:`event subscriber <event_dispatcher-using-event-subscribers>`::
140140

141-
// src/Form/EventListener/AddNameFieldSubscriber.php
142-
namespace App\Form\EventListener;
141+
// src/Form/EventSubscriber/AddNameFieldSubscriber.php
142+
namespace App\Form\EventSubscriber;
143143

144144
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
145145
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -172,7 +172,7 @@ Great! Now use that in your form class::
172172
namespace App\Form\Type;
173173

174174
// ...
175-
use App\Form\EventListener\AddNameFieldSubscriber;
175+
use App\Form\EventSubscriber\AddNameFieldSubscriber;
176176

177177
class ProductType extends AbstractType
178178
{

serializer.rst

+22
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,28 @@ normalizers (in order of priority):
14171417
This denormalizer converts an array of arrays to an array of objects
14181418
(with the given type). See :ref:`Handling Arrays <serializer-handling-arrays>`.
14191419

1420+
Use :class:`Symfony\\Component\\PropertyInfo\\PropertyInfoExtractor` to provide
1421+
hints with annotations like ``@var Person[]``:
1422+
1423+
.. configuration-block::
1424+
1425+
.. code-block:: php-standalone
1426+
1427+
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
1428+
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
1429+
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
1430+
use Symfony\Component\Serializer\Encoder\JsonEncoder;
1431+
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
1432+
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
1433+
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
1434+
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
1435+
use Symfony\Component\Serializer\Serializer;
1436+
1437+
$propertyInfo = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
1438+
$normalizers = [new ObjectNormalizer(new ClassMetadataFactory(new AttributeLoader()), null, null, $propertyInfo), new ArrayDenormalizer()];
1439+
1440+
$this->serializer = new Serializer($normalizers, [new JsonEncoder()]);
1441+
14201442
:class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer`
14211443
This is the most powerful default normalizer and used for any object
14221444
that could not be normalized by the other normalizers.

0 commit comments

Comments
 (0)