Skip to content

Adopt shared hydration pipeline from Data#100

Merged
alganet merged 1 commit into
Respect:masterfrom
alganet:hydration
Mar 19, 2026
Merged

Adopt shared hydration pipeline from Data#100
alganet merged 1 commit into
Respect:masterfrom
alganet:hydration

Conversation

@alganet

@alganet alganet commented Mar 19, 2026

Copy link
Copy Markdown
Member
  • Use Collection::resolveEntityName() in fetchSingle() instead of instanceof Typed check, removing the Typed import entirely
  • Delegate Filtered persist to parent::persist() which now handles it in AbstractMapper
  • Remove postHydrate(), tryHydration(), buildEntitiesInstances() — now inherited from AbstractMapper
  • Remove dead $entities initialization in fetchMulti()
  • Remove unused getSetterStyle() method and str_replace import
  • Remove unnecessary $factory local variable aliases, access $this->entityFactory directly
  • Fix extractAndOperateCompositions() to use key-based removal instead of value-based array_diff, with test for matching-value edge case
  • Assert getColumnMeta() result instead of silently skipping

- Use Collection::resolveEntityName() in fetchSingle() instead of
  instanceof Typed check, removing the Typed import entirely
- Delegate Filtered persist to parent::persist() which now handles it
  in AbstractMapper
- Remove postHydrate(), tryHydration(), buildEntitiesInstances() — now
  inherited from AbstractMapper
- Remove dead $entities initialization in fetchMulti()
- Remove unused getSetterStyle() method and str_replace import
- Remove unnecessary $factory local variable aliases, access
  $this->entityFactory directly
- Fix extractAndOperateCompositions() to use key-based removal instead
  of value-based array_diff, with test for matching-value edge case
- Assert getColumnMeta() result instead of silently skipping
@alganet alganet requested a review from Copilot March 19, 2026 00:31

Copilot AI left a comment

Copy link
Copy Markdown

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 updates Respect\Relational\Mapper to adopt the shared hydration/persistence pipeline now provided by respect/data’s AbstractMapper, reducing local duplication while keeping Relational-specific query building and entity materialization.

Changes:

  • Delegate Filtered persistence and hydration steps to AbstractMapper (removing local hydration helpers and simplifying persist()/fetch flows).
  • Replace Typed-specific logic in fetchSingle() with Collection::resolveEntityName(), removing the Typed dependency/import.
  • Simplify entity factory usage by removing local aliases and using $this->entityFactory directly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/Mapper.php
@alganet alganet marked this pull request as ready for review March 19, 2026 00:36
@alganet alganet merged commit 1e276fd into Respect:master Mar 19, 2026
7 checks passed
@alganet alganet deleted the hydration branch March 19, 2026 00:36
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.31%. Comparing base (7d59a55) to head (5ced426).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #100      +/-   ##
============================================
- Coverage     99.37%   99.31%   -0.07%     
+ Complexity      180      165      -15     
============================================
  Files             3        3              
  Lines           478      436      -42     
============================================
- Hits            475      433      -42     
  Misses            3        3              

☔ 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.

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