Skip to content

Commit 572533f

Browse files
committed
Merge branch '6.4' into 7.2
* 6.4: Update dynamic_form_modification.rst Minor tweaks [Serializer] Update serializer.rst
2 parents 635d3c8 + 35c408c commit 572533f

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
@@ -1409,6 +1409,28 @@ normalizers (in order of priority):
14091409
This denormalizer converts an array of arrays to an array of objects
14101410
(with the given type). See :ref:`Handling Arrays <serializer-handling-arrays>`.
14111411

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

0 commit comments

Comments
 (0)