getCollectionPersister() 공개 메소드

Gets a collection persister for a collection-valued association.
public getCollectionPersister ( array $association ) : AbstractCollectionPersister
$association array
리턴 AbstractCollectionPersister
예제 #1
0
 /**
  * {@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();
         }
     }
 }
 /**
  * {@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;
 }