#1277 DDC-3346 - removing array-based persister context handling (better to just use private props)
This commit is contained in:
parent
dff365318d
commit
97ea6a7d85
@ -178,14 +178,19 @@ class BasicEntityPersister implements EntityPersister
|
|||||||
private $identifierFlattener;
|
private $identifierFlattener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var CachedPersisterContext[]
|
* @var CachedPersisterContext
|
||||||
*/
|
*/
|
||||||
protected $cachedPersisterContexts = [];
|
protected $currentPersisterContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var CachedPersisterContext
|
* @var CachedPersisterContext
|
||||||
*/
|
*/
|
||||||
protected $currentPersisterContext;
|
private $limitsHandlingContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CachedPersisterContext
|
||||||
|
*/
|
||||||
|
private $noLimitsContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager
|
* Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager
|
||||||
@ -196,18 +201,18 @@ class BasicEntityPersister implements EntityPersister
|
|||||||
*/
|
*/
|
||||||
public function __construct(EntityManagerInterface $em, ClassMetadata $class)
|
public function __construct(EntityManagerInterface $em, ClassMetadata $class)
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->class = $class;
|
$this->class = $class;
|
||||||
$this->conn = $em->getConnection();
|
$this->conn = $em->getConnection();
|
||||||
$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'] = $this->currentPersisterContext = new CachedPersisterContext(
|
$this->noLimitsContext = $this->currentPersisterContext = new CachedPersisterContext(
|
||||||
$class,
|
$class,
|
||||||
new Query\ResultSetMapping(),
|
new Query\ResultSetMapping(),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
$this->cachedPersisterContexts['withLimits'] = new CachedPersisterContext(
|
$this->limitsHandlingContext = new CachedPersisterContext(
|
||||||
$class,
|
$class,
|
||||||
new Query\ResultSetMapping(),
|
new Query\ResultSetMapping(),
|
||||||
true
|
true
|
||||||
@ -1966,11 +1971,11 @@ class BasicEntityPersister implements EntityPersister
|
|||||||
protected function switchPersisterContext($offset, $limit)
|
protected function switchPersisterContext($offset, $limit)
|
||||||
{
|
{
|
||||||
if (null === $offset && null === $limit) {
|
if (null === $offset && null === $limit) {
|
||||||
$this->currentPersisterContext = $this->cachedPersisterContexts['noLimits'];
|
$this->currentPersisterContext = $this->noLimitsContext;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->currentPersisterContext = $this->cachedPersisterContexts['withLimits'];
|
$this->currentPersisterContext = $this->limitsHandlingContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user