Skip to content

Commit

Permalink
Fix caching join query when change filters
Browse files Browse the repository at this point in the history
  • Loading branch information
dbannik committed Oct 22, 2024
1 parent 0fe6880 commit b3735ef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Persisters/Entity/BasicEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ class BasicEntityPersister implements EntityPersister
/** @var CachedPersisterContext */
private $noLimitsContext;

/** @var ?string */
private $filterHash = null;

/**
* Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager
* and persists instances of the class described by the given ClassMetadata descriptor.
Expand Down Expand Up @@ -1271,7 +1274,7 @@ final protected function getOrderBySQL(array $orderBy, string $baseTableAlias):
*/
protected function getSelectColumnsSQL()
{
if ($this->currentPersisterContext->selectColumnListSql !== null) {
if ($this->currentPersisterContext->selectColumnListSql !== null && $this->filterHash === $this->em->getFilters()->getHash()) {
return $this->currentPersisterContext->selectColumnListSql;
}

Expand Down Expand Up @@ -1378,6 +1381,7 @@ protected function getSelectColumnsSQL()
}

$this->currentPersisterContext->selectColumnListSql = implode(', ', $columnList);
$this->filterHash = $this->em->getFilters()->getHash();

return $this->currentPersisterContext->selectColumnListSql;
}
Expand Down

0 comments on commit b3735ef

Please sign in to comment.