Replace Flat hydrator with PrestyledAssoc for alias-keyed rows#26
Merged
alganet merged 1 commit intoRespect:masterfrom Apr 1, 2026
Merged
Replace Flat hydrator with PrestyledAssoc for alias-keyed rows#26alganet merged 1 commit intoRespect:masterfrom
alganet merged 1 commit intoRespect:masterfrom
Conversation
PrestyledAssoc hydrates associative rows whose keys follow the `specifier__styledProp` convention, grouping by prefix and mapping directly to entities. This eliminates the reverse-iteration, boundary detection, and entity-stack machinery from the old Flat hydrator. Also adds EntityFactory::enumerateFields() for DB-column-to-property mapping, a `styled` flag on set() to skip redundant style conversion, and Composite::COMPOSITION_MARKER to centralize the join-alias prefix.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #26 +/- ##
============================================
- Coverage 98.39% 98.23% -0.16%
- Complexity 294 300 +6
============================================
Files 17 17
Lines 622 624 +2
============================================
+ Hits 612 613 +1
- Misses 10 11 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR replaces the previous “flat row” hydrator with a new PrestyledAssoc hydrator that consumes alias-keyed associative rows (specifier__styledProp) and simplifies multi-entity hydration, while also adding supporting EntityFactory utilities and composite alias constants.
Changes:
- Add
PrestyledAssochydrator and corresponding PHPUnit coverage; removeFlathydrator and its tests. - Extend
EntityFactorywithenumerateFields()and astyledflag onset()to support pre-styled hydration. - Introduce
Composite::COMPOSITION_MARKERto centralize composition alias naming.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/Hydrators/PrestyledAssoc.php |
New hydrator that groups alias-keyed columns by prefix and hydrates entities directly. |
tests/Hydrators/PrestyledAssocTest.php |
New tests covering basic hydration, typing, composites, caching, and unknown prefixes. |
src/Hydrators/Flat.php |
Removed legacy flat-row hydrator implementation. |
tests/Hydrators/FlatTest.php |
Removed tests for legacy flat-row hydrator. |
src/EntityFactory.php |
Adds enumerateFields() and set(..., styled: bool) optimization for pre-styled props. |
tests/EntityFactoryTest.php |
Adds tests for enumerateFields() and set(..., styled: true). |
src/Collections/Composite.php |
Adds a constant for composition alias marker used by hydration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
PrestyledAssoc hydrates associative rows whose keys follow the
specifier__styledPropconvention, grouping by prefix and mapping directly to entities. This eliminates the reverse-iteration, boundary detection, and entity-stack machinery from the old Flat hydrator.Also adds EntityFactory::enumerateFields() for DB-column-to-property mapping, a
styledflag on set() to skip redundant style conversion, and Composite::COMPOSITION_MARKER to centralize the join-alias prefix.