本文整理匯總了PHP中Doctrine\ORM\UnitOfWork::getCollectionPersister方法的典型用法代碼示例。如果您正苦於以下問題:PHP UnitOfWork::getCollectionPersister方法的具體用法?PHP UnitOfWork::getCollectionPersister怎麽用?PHP UnitOfWork::getCollectionPersister使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\UnitOfWork
的用法示例。
在下文中一共展示了UnitOfWork::getCollectionPersister方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: evictCollectionRegions
/**
* {@inheritdoc}
*/
public function evictCollectionRegions()
{
$metadatas = $this->em->getMetadataFactory()->getAllMetadata();
foreach ($metadatas as $metadata) {
foreach ($metadata->associationMappings as $association) {
if (!$association['type'] & ClassMetadata::TO_MANY) {
continue;
}
$persister = $this->uow->getCollectionPersister($association);
if (!$persister instanceof CachedPersister) {
continue;
}
$persister->getCacheRegion()->evictAll();
}
}
}
示例2: loadOneToManyCollection
/**
* {@inheritdoc}
*/
public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
{
$persister = $this->uow->getCollectionPersister($assoc);
$hasCache = $persister instanceof CachedPersister;
if ($hasCache) {
$ownerId = $this->uow->getEntityIdentifier($coll->getOwner());
$key = new CollectionCacheKey($assoc['sourceEntity'], $assoc['fieldName'], $ownerId);
$list = $persister->loadCollectionCache($coll, $key);
if ($list !== null) {
if ($this->cacheLogger) {
$this->cacheLogger->collectionCacheHit($persister->getCacheRegion()->getName(), $key);
}
return $list;
}
}
$list = $this->persister->loadOneToManyCollection($assoc, $sourceEntity, $coll);
if ($hasCache) {
$persister->storeCollectionCache($key, $list);
if ($this->cacheLogger) {
$this->cacheLogger->collectionCacheMiss($persister->getCacheRegion()->getName(), $key);
}
}
return $list;
}