Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] PropertyNormalizer doesnt process parent class properties #24152

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

Closed
ivoba opened this issue Sep 11, 2017 · 0 comments
Closed

[Serializer] PropertyNormalizer doesnt process parent class properties #24152

ivoba opened this issue Sep 11, 2017 · 0 comments

Comments

@ivoba
Copy link
Contributor

ivoba commented Sep 11, 2017

Q A
Bug report? yes
Feature request? yes
BC Break report? no
RFC? no
Symfony version 2.8 - 3.x

When using PropertyNormalizer on a nested object that has objects which use inheritance the parent class properties arent normalized.
The $reflectionObject in extractAttributes() doesnt get the private properties of the parent class.
This is normal behaviour of the PHP reflection.
However as the PropertyNormalizer doesnt respect private settings of properties anyway, i think it should be default that it also gets the private properties of the parent class.

Therefor extractAttributes() should recursivly call $reflectionObject->getParentClass()->getProperties() to return all properties.

WDYT @dunglas ?

@fabpot fabpot closed this as completed Oct 11, 2017
fabpot added a commit that referenced this issue Oct 11, 2017
…malizer (ivoba)

This PR was squashed before being merged into the 3.4 branch (closes #24321).

Discussion
----------

added ability to handle parent classes for PropertyNormalizer

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24152 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the 3.4,
  legacy code removals go to the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->

This adds the ability for PropertyNormalizer to normalize/denormalize properties from parent classes.

Commits
-------

5ecafc5 added ability to handle parent classes for PropertyNormalizer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants