Skip to content
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

[FrameworkBundle] Reuse PropertyAccessor service for ObjectNormalizer #14989

Closed
wants to merge 3 commits into from

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Jun 15, 2015

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.

@Tobion
Copy link
Contributor

Tobion commented Jun 15, 2015

👍

@dunglas
Copy link
Member Author

dunglas commented Jun 15, 2015

Travis errors are unrelated.

@fabpot
Copy link
Member

fabpot commented Jun 15, 2015

As the property_accessor service is used by the form framework as well, what about creating two aliases, one for the serializer and one for the form that points to the true property_accessor service? This way, it's easy to have a specific one for the serializer by overriding the alias.

<!-- 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" on-invalid="ignore" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the on-invalid parameter is still useful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove it.

@dunglas
Copy link
Member Author

dunglas commented Jun 18, 2015

done

@fabpot
Copy link
Member

fabpot commented Jun 19, 2015

Thank you @dunglas.

fabpot added a commit that referenced this pull request Jun 19, 2015
…tNormalizer (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
@fabpot fabpot closed this Jun 19, 2015
@dunglas dunglas deleted the normalizer_reuse_propertyaccess branch December 5, 2015 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants