diff --git a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php index 24bafa550..fd7408f2b 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php @@ -182,6 +182,11 @@ class BasicEntityPersister implements EntityPersister */ protected $cachedPersisterContexts = []; + /** + * @var CachedPersisterContext + */ + protected $currentPersisterContext; + /** * Initializes a new BasicEntityPersister that uses the given EntityManager * and persists instances of the class described by the given ClassMetadata descriptor. @@ -197,7 +202,11 @@ class BasicEntityPersister implements EntityPersister $this->platform = $this->conn->getDatabasePlatform(); $this->quoteStrategy = $em->getConfiguration()->getQuoteStrategy(); $this->identifierFlattener = new IdentifierFlattener($em->getUnitOfWork(), $em->getMetadataFactory()); - $this->cachedPersisterContexts['noLimits'] = new CachedPersisterContext( + $this->cachedPersisterContexts['noLimits'] = $this->currentPersisterContext = new CachedPersisterContext( + $class, + new Query\ResultSetMapping() + ); + $this->cachedPersisterContexts['withLimits'] = new CachedPersisterContext( $class, new Query\ResultSetMapping() ); @@ -1927,4 +1936,13 @@ class BasicEntityPersister implements EntityPersister $sql = implode(' AND ', $filterClauses); return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" } + + private function loadPersisterContext($offset, $limit) + { + if (null === $offset && null === $limit) { + $this->currentPersisterContext = $this->cachedPersisterContexts['noLimits']; + } + + $this->currentPersisterContext = $this->cachedPersisterContexts['withLimits']; + } }