Skip to content

Replace Flat hydrator with PrestyledAssoc for alias-keyed rows#26

Merged
alganet merged 1 commit intoRespect:masterfrom
alganet:immutable
Apr 1, 2026
Merged

Replace Flat hydrator with PrestyledAssoc for alias-keyed rows#26
alganet merged 1 commit intoRespect:masterfrom
alganet:immutable

Conversation

@alganet
Copy link
Copy Markdown
Member

@alganet alganet commented Apr 1, 2026

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.

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-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.23%. Comparing base (bc63e1e) to head (8b5503a).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 PrestyledAssoc hydrator and corresponding PHPUnit coverage; remove Flat hydrator and its tests.
  • Extend EntityFactory with enumerateFields() and a styled flag on set() to support pre-styled hydration.
  • Introduce Composite::COMPOSITION_MARKER to 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.

@alganet alganet marked this pull request as ready for review April 1, 2026 06:53
@alganet alganet merged commit 4055991 into Respect:master Apr 1, 2026
7 checks passed
@alganet alganet deleted the immutable branch April 1, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants