bug #14989 [FrameworkBundle] Reuse PropertyAccessor service for ObjectNormalizer (dunglas)

This PR was squashed before being merged into the 2.7 branch (closes #14989).

Discussion
----------

[FrameworkBundle] Reuse PropertyAccessor service for ObjectNormalizer

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Inject the `property_accessor` service if available in the `ObjectNormalize` instead of creating a new instance.

Commits
-------

256d441 [FrameworkBundle] Reuse PropertyAccessor service for ObjectNormalizer
This commit is contained in:
Fabien Potencier 2015-06-19 17:02:37 +02:00
commit ad12251781
2 changed files with 7 additions and 1 deletions

View File

@ -55,8 +55,10 @@
</service>
<!-- CoreExtension -->
<service id="form.property_accessor" alias="property_accessor" public="false" />
<service id="form.type.form" class="Symfony\Component\Form\Extension\Core\Type\FormType">
<argument type="service" id="property_accessor"/>
<argument type="service" id="form.property_accessor" />
<tag name="form.type" alias="form" />
</service>
<service id="form.type.birthday" class="Symfony\Component\Form\Extension\Core\Type\BirthdayType">

View File

@ -17,9 +17,13 @@
<argument type="collection" />
</service>
<service id="serializer.property_accessor" alias="property_accessor" public="false" />
<!-- Normalizer -->
<service id="serializer.normalizer.object" class="Symfony\Component\Serializer\Normalizer\ObjectNormalizer" public="false">
<argument type="service" id="serializer.mapping.class_metadata_factory" />
<argument>null</argument>
<argument type="service" id="serializer.property_accessor" />
<!-- Run after all custom serializers -->
<tag name="serializer.normalizer" priority="-1000" />