コード例 #1
0
 /**
  * @param \Doctrine\ORM\Persisters\Entity\EntityPersister $persister The entity persister to cache.
  * @param \Doctrine\ORM\Cache\Region                      $region    The entity cache region.
  * @param \Doctrine\ORM\EntityManagerInterface            $em        The entity manager.
  * @param \Doctrine\ORM\Mapping\ClassMetadata             $class     The entity metadata.
  */
 public function __construct(EntityPersister $persister, Region $region, EntityManagerInterface $em, ClassMetadata $class)
 {
     $configuration = $em->getConfiguration();
     $cacheConfig = $configuration->getSecondLevelCacheConfiguration();
     $cacheFactory = $cacheConfig->getCacheFactory();
     $this->class = $class;
     $this->region = $region;
     $this->persister = $persister;
     $this->cache = $em->getCache();
     $this->regionName = $region->getName();
     $this->uow = $em->getUnitOfWork();
     $this->metadataFactory = $em->getMetadataFactory();
     $this->cacheLogger = $cacheConfig->getCacheLogger();
     $this->timestampRegion = $cacheFactory->getTimestampRegion();
     $this->hydrator = $cacheFactory->buildEntityHydrator($em, $class);
     $this->timestampKey = new TimestampCacheKey($this->class->getTableName());
 }
コード例 #2
0
 /**
  * @param \Doctrine\ORM\Persisters\Collection\CollectionPersister $persister   The collection persister that will be cached.
  * @param \Doctrine\ORM\Cache\Region                              $region      The collection region.
  * @param \Doctrine\ORM\EntityManagerInterface                    $em          The entity manager.
  * @param array                                                   $association The association mapping.
  */
 public function __construct(CollectionPersister $persister, Region $region, EntityManagerInterface $em, array $association)
 {
     $configuration = $em->getConfiguration();
     $cacheConfig = $configuration->getSecondLevelCacheConfiguration();
     $cacheFactory = $cacheConfig->getCacheFactory();
     $this->region = $region;
     $this->persister = $persister;
     $this->association = $association;
     $this->regionName = $region->getName();
     $this->uow = $em->getUnitOfWork();
     $this->metadataFactory = $em->getMetadataFactory();
     $this->cacheLogger = $cacheConfig->getCacheLogger();
     $this->hydrator = $cacheFactory->buildCollectionHydrator($em, $association);
     $this->sourceEntity = $em->getClassMetadata($association['sourceEntity']);
     $this->targetEntity = $em->getClassMetadata($association['targetEntity']);
 }
コード例 #3
0
 /**
  * @param \Doctrine\ORM\Cache\Region $region
  */
 public function setRegion(Region $region)
 {
     $this->regions[$region->getName()] = $region;
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function getName()
 {
     $this->calls[__FUNCTION__][] = array();
     $this->throwException(__FUNCTION__);
     return $this->region->getName();
 }