mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
PersistentCollection::get with fetch EXTRA_LAZY fetches not associated entities #6198
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @crtl on GitHub (Mar 6, 2019).
Bug Report
Summary
Calling
Doctrine\ORM\PersistentCollection::getreturns an entity even if it is not in the collection.The relation has to be configured as
fetch="EXTRA_LAZY"and has to have anindex-byconfig.Current behavior
Calling
getreturns an entity even if it is not part of the collectionHow to reproduce
many-to-manyrelationshipEXTRA_LAZYand index-byidgeton an empty collection with an entity id that exists but is not relatedExpected behavior
getshould not return an entity when its not associated, even when the entity exists.Example:
@Ocramius commented on GitHub (Mar 8, 2019):
If I get this right, this looks like a missing criteria filtering by collection owner in the persister logic.