#1277 DDC-3346 DDC-3531 - caching the currently in use persister context
This commit is contained in:
parent
ebdfab8f2c
commit
8b9171c8ad
@ -182,6 +182,11 @@ class BasicEntityPersister implements EntityPersister
|
|||||||
*/
|
*/
|
||||||
protected $cachedPersisterContexts = [];
|
protected $cachedPersisterContexts = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CachedPersisterContext
|
||||||
|
*/
|
||||||
|
protected $currentPersisterContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager
|
* Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager
|
||||||
* and persists instances of the class described by the given ClassMetadata descriptor.
|
* 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->platform = $this->conn->getDatabasePlatform();
|
||||||
$this->quoteStrategy = $em->getConfiguration()->getQuoteStrategy();
|
$this->quoteStrategy = $em->getConfiguration()->getQuoteStrategy();
|
||||||
$this->identifierFlattener = new IdentifierFlattener($em->getUnitOfWork(), $em->getMetadataFactory());
|
$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,
|
$class,
|
||||||
new Query\ResultSetMapping()
|
new Query\ResultSetMapping()
|
||||||
);
|
);
|
||||||
@ -1927,4 +1936,13 @@ class BasicEntityPersister implements EntityPersister
|
|||||||
$sql = implode(' AND ', $filterClauses);
|
$sql = implode(' AND ', $filterClauses);
|
||||||
return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL"
|
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'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user