Skip to content

Fix embedded entities loading via BulkLoader#565

Merged
roxblnfk merged 5 commits into
2.xfrom
fix-embedded-deferred-loading
May 22, 2026
Merged

Fix embedded entities loading via BulkLoader#565
roxblnfk merged 5 commits into
2.xfrom
fix-embedded-deferred-loading

Conversation

@roxblnfk
Copy link
Copy Markdown
Member

@roxblnfk roxblnfk commented May 21, 2026

🔍 What was changed

📝 Checklist

  • How was this tested:
    • Tested manually
    • Unit tests added

📃 Documentation

@roxblnfk roxblnfk force-pushed the fix-embedded-deferred-loading branch from 8d7e72c to 4d45831 Compare May 22, 2026 10:42
@roxblnfk roxblnfk marked this pull request as ready for review May 22, 2026 10:46
@roxblnfk roxblnfk requested a review from Copilot May 22, 2026 10:46
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

Adds end-to-end coverage and runtime support for lazy-loaded embedded (same-row) relations when using BulkLoader, ensuring embedded entities can be batch-hydrated without per-entity follow-up queries.

Changes:

  • Implement embedded-relation handling in Relation\BulkLoader by warming the heap via a batched Select and then resolving embedded references.
  • Add new cross-driver integration test case Case565 (schema, entities, and assertions) covering Select::load(), promise resolution, and BulkLoader::load().
  • Tighten PHPDoc types for relation maps / inner keys to improve static analysis.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/ORM/Functional/Driver/SQLServer/Integration/Case565/CaseTest.php SQLServer wrapper to run the shared Case565 integration suite.
tests/ORM/Functional/Driver/SQLite/Integration/Case565/CaseTest.php SQLite wrapper to run the shared Case565 integration suite.
tests/ORM/Functional/Driver/Postgres/Integration/Case565/CaseTest.php Postgres wrapper to run the shared Case565 integration suite.
tests/ORM/Functional/Driver/MySQL/Integration/Case565/CaseTest.php MySQL wrapper to run the shared Case565 integration suite.
tests/ORM/Functional/Driver/Common/Integration/Case565/schema.php Schema defining embedded relations and supporting entities for Case565.
tests/ORM/Functional/Driver/Common/Integration/Case565/Entity/UserProfile.php Embedded entity used by the user.profile relation.
tests/ORM/Functional/Driver/Common/Integration/Case565/Entity/UserCredentials.php Embedded entity used by the user.credentials relation.
tests/ORM/Functional/Driver/Common/Integration/Case565/Entity/User.php Root entity with embedded relations and a has-many relation for mixed loading scenarios.
tests/ORM/Functional/Driver/Common/Integration/Case565/Entity/OrderShipping.php Embedded entity used by the order.shipping relation (composite PK coverage).
tests/ORM/Functional/Driver/Common/Integration/Case565/Entity/Order.php Root entity with composite PK and embedded relation for BulkLoader coverage.
tests/ORM/Functional/Driver/Common/Integration/Case565/Entity/Comment.php Related entity for has-many loading alongside embedded relations.
tests/ORM/Functional/Driver/Common/Integration/Case565/CaseTest.php Shared integration assertions validating embedded loading via Select, promise resolution, and BulkLoader (incl. query-count expectations).
src/RelationMap.php PHPDoc type refinements for relation map collections and getRelations().
src/Relation/RelationInterface.php Adds PHPDoc for getInnerKeys() return shape.
src/Relation/BulkLoader.php Implements batched embedded loading via Select, tracks embedded relations, and resolves embedded references during hydration.

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

Comment thread src/Relation/BulkLoader.php
Comment thread src/Relation/BulkLoader.php
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.59%. Comparing base (62ded83) to head (09374ea).
⚠️ Report is 1 commits behind head on 2.x.

Files with missing lines Patch % Lines
src/Relation/BulkLoader.php 86.95% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x     #565      +/-   ##
============================================
+ Coverage     91.55%   91.59%   +0.03%     
- Complexity     2003     2013      +10     
============================================
  Files           131      131              
  Lines          5200     5223      +23     
============================================
+ Hits           4761     4784      +23     
  Misses          439      439              

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

@roxblnfk roxblnfk merged commit abaaa51 into 2.x May 22, 2026
27 of 30 checks passed
@roxblnfk roxblnfk deleted the fix-embedded-deferred-loading branch May 22, 2026 11:52
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.

2 participants