mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
UnitOfWork::persisters caches join statements #7484
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 @oojacoboo on GitHub (Mar 5, 2025).
Bug Report
Summary
I've been dealing with an issue where join conditions on a query, combined with a filter, were incorrect. It was using the join conditions from a previous query on the same entity within a loop.
Current behavior
It turns out the issue is related to the
UnitOfWork::getEntityPersistermethod, specifically the use of thepersistersproperty for state/cache.Expected behavior
Avoid caching these persisters, or add improved logic to rebuild the join statement in the
EntityPersisterinstance. I wasn't able to determine the proper way to ensure theselectJoinSqlis properly rebuilt when reusing an existing persister instance.How to reproduce
The issue exists with the
BasicEntityPersister::currentPersisterContext->selectJoinSqlproperty. When the persister is cached within theUnitOfWork, thisselectJoinSqlnever gets rebuilt, resulting in an incorrect join statement. It's specifically seen with filter conditions.