[Tree] Fix TreeObjectHydrator compatibility with ORM 3 - #3041
Open
PhilDaiguille wants to merge 2 commits into
Open
[Tree] Fix TreeObjectHydrator compatibility with ORM 3#3041PhilDaiguille wants to merge 2 commits into
PhilDaiguille wants to merge 2 commits into
Conversation
PhilDaiguille
force-pushed
the
fix/tree-object-hydrator-orm3
branch
2 times, most recently
from
March 9, 2026 21:53
c437c35 to
4a559b0
Compare
PhilDaiguille
force-pushed
the
fix/tree-object-hydrator-orm3
branch
from
March 9, 2026 21:54
4a559b0 to
0e61da2
Compare
There was a problem hiding this comment.
Pull request overview
Fixes a Doctrine ORM 3 compatibility bug in TreeObjectHydrator when reflection encounters the parent association before the children association, and adds coverage intended to prevent regressions.
Changes:
- Updated
TreeObjectHydrator::getChildrenField()to better handle ORM 3 association mapping objects. - Added a new tree fixture (
RootCategoryReversed) and a dedicated hydration test for the “reversed field order” scenario. - Documented the fix in the Unreleased changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Tree/Hydrator/ORM/TreeObjectHydrator.php |
Adjusts children-field detection to support ORM 3 mapping objects. |
tests/Gedmo/Tree/Fixture/RootCategoryReversed.php |
Adds a new fixture intended to model the parent/children field-order edge case. |
tests/Gedmo/Tree/TreeObjectHydratorTest.php |
Adds a new test case and registers the new fixture for hydration coverage. |
CHANGELOG.md |
Adds an Unreleased “Fixed” entry describing the ORM 3 compatibility fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…operty order Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello ! Fix bug in issue : #2921
This pull request fixes a compatibility issue in the
TreeObjectHydratorwith ORM 3 when the parent property is defined before the children property in an entity. It also adds a new test fixture and test case to ensure this scenario is properly handled.Bug fix for ORM 3 compatibility:
TreeObjectHydratorto correctly handle association mappings whether they are arrays or objects, ensuring the hydrator works when the parent property is defined before the children property in tree entities.TreeObjectHydratorcompatibility with ORM 3.Testing improvements:
RootCategoryReversedwith the parent property defined before children, to test the fixed scenario.RootCategoryReversedin the test suite and added a test casetestFullTreeHydrationWithReversedFieldOrderto verify correct tree hydration when field order is reversed. [1] [2] [3]