You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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::getEntityPersister method, specifically the use of the persisters property for state/cache.
publicfunction getEntityPersister(string$entityName): EntityPersister// This if block is the issue. When commented out, the issue is resolved.
if (isset($this->persisters[$entityName])) {
return$this->persisters[$entityName];
}
...
}
Expected behavior
Avoid caching these persisters, or add improved logic to rebuild the join statement in the EntityPersister instance. I wasn't able to determine the proper way to ensure the selectJoinSql is properly rebuilt when reusing an existing persister instance.
How to reproduce
The issue exists with the BasicEntityPersister::currentPersisterContext->selectJoinSql property. When the persister is cached within the UnitOfWork, this selectJoinSql never gets rebuilt, resulting in an incorrect join statement. It's specifically seen with filter conditions.
The text was updated successfully, but these errors were encountered:
oojacoboo
added a commit
to rentpost/doctrine-orm
that referenced
this issue
Mar 6, 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::getEntityPersister
method, specifically the use of thepersisters
property for state/cache.Expected behavior
Avoid caching these persisters, or add improved logic to rebuild the join statement in the
EntityPersister
instance. I wasn't able to determine the proper way to ensure theselectJoinSql
is properly rebuilt when reusing an existing persister instance.How to reproduce
The issue exists with the
BasicEntityPersister::currentPersisterContext->selectJoinSql
property. When the persister is cached within theUnitOfWork
, thisselectJoinSql
never gets rebuilt, resulting in an incorrect join statement. It's specifically seen with filter conditions.The text was updated successfully, but these errors were encountered: