[PR #710] [MERGED] Fix extra lazy get #8595

Open
opened 2026-01-22 16:00:40 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/710
Author: @sandermarechal
Created: 6/27/2013
Status: Merged
Merged: 6/30/2013
Merged by: @beberlei

Base: masterHead: extra-lazy-get-fix


📝 Commits (2)

  • 5635fa6 Check owning entitiy on extra lazy get with OneToMany relation
  • 06ed21e Remove extra-lazy-get for ManyToMany relation

📊 Changes

4 files changed (+3 additions, -42 deletions)

View changed files

📝 lib/Doctrine/ORM/PersistentCollection.php (+1 -0)
📝 lib/Doctrine/ORM/Persisters/ManyToManyPersister.php (+0 -18)
📝 lib/Doctrine/ORM/Persisters/OneToManyPersister.php (+1 -1)
📝 tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php (+1 -23)

📄 Description

I made a big mistake in PR #706, my apologies. The get() function in the OneToManyPersister and ManyToManyPersister did not add the collection owner to the load query. The unit tests failed to detect this because the first entity is always used (ID 1) was used to test with.

The first commit in this PR fixes this for the OneToMayPersister.

I could not find a way to fix this for the ManyToManyPersister. Problem is that you can only use conditions on the owning side of a ManyToMany relation, not on the inverse side. Code like load(array($mapping['inversedBy'] => $coll->getOwner()), ...) gave an ORMException.

Therefor, the second commit in this PR removes the extra-lazy-get for ManyToMany relations. If anyone has any ideas how to make this work for the ManyToMany side, please let me know.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/710 **Author:** [@sandermarechal](https://github.com/sandermarechal) **Created:** 6/27/2013 **Status:** ✅ Merged **Merged:** 6/30/2013 **Merged by:** [@beberlei](https://github.com/beberlei) **Base:** `master` ← **Head:** `extra-lazy-get-fix` --- ### 📝 Commits (2) - [`5635fa6`](https://github.com/doctrine/orm/commit/5635fa60a4bea0580b969a5cd9235e2ae6e18a78) Check owning entitiy on extra lazy get with OneToMany relation - [`06ed21e`](https://github.com/doctrine/orm/commit/06ed21e88303b41381d7b7488033bcef983277dd) Remove extra-lazy-get for ManyToMany relation ### 📊 Changes **4 files changed** (+3 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/PersistentCollection.php` (+1 -0) 📝 `lib/Doctrine/ORM/Persisters/ManyToManyPersister.php` (+0 -18) 📝 `lib/Doctrine/ORM/Persisters/OneToManyPersister.php` (+1 -1) 📝 `tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php` (+1 -23) </details> ### 📄 Description I made a big mistake in PR #706, my apologies. The get() function in the OneToManyPersister and ManyToManyPersister did not add the collection owner to the load query. The unit tests failed to detect this because the first entity is always used (ID 1) was used to test with. The first commit in this PR fixes this for the OneToMayPersister. I could not find a way to fix this for the ManyToManyPersister. Problem is that you can only use conditions on the owning side of a ManyToMany relation, not on the inverse side. Code like `load(array($mapping['inversedBy'] => $coll->getOwner()), ...)` gave an ORMException. Therefor, the second commit in this PR removes the extra-lazy-get for ManyToMany relations. If anyone has any ideas how to make this work for the ManyToMany side, please let me know. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 16:00:40 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8595