You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
…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
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 ?
The text was updated successfully, but these errors were encountered: