-
Couldn't load subscription status.
- Fork 28
⚡ Hydrate not-loaded objects on retrieval #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
(Note that I asked copilot for a review to test) |
There was a problem hiding this 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 fixes a bug where retrieving an already instantiated but not-loaded object from the object storage would not hydrate it, causing subsequent property access to trigger unnecessary database queries. The fix ensures that when an object is retrieved from storage in a STATE_NOT_LOADED state, it gets hydrated immediately with the available data.
Key Changes:
- Added hydration logic in
InnerResultIteratorto check if retrieved objects are not loaded and hydrate them - Added two test cases to verify the fix works for both direct iteration and reference access scenarios
- Added helper method
findByIdsinTestCountryDaoto support the new test cases
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/InnerResultIterator.php | Added STATE_NOT_LOADED check and hydration call when retrieving objects from storage |
| tests/TDBMDaoGeneratorTest.php | Added two test methods to verify objects are properly hydrated on retrieval |
| tests/Dao/TestCountryDao.php | Added findByIds helper method for testing bulk retrieval by IDs |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
64eb424 to
1d5d199
Compare
aafa3d4 to
16ef0fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Previously there were a bug (reproduced in tests) where retrieving an already not-loaded object would not hydrate it and hence trigger a new query on access.
16ef0fc to
790979a
Compare
Previously there were a bug (reproduced in tests) where retrieving an already not-loaded object would not hydrate it and hence trigger a new query on access.