getPreloadContainer() публичный Метод

public getPreloadContainer ( ) : Nextras\Orm\Collection\IEntityPreloadContainer
Результат Nextras\Orm\Collection\IEntityPreloadContainer
Пример #1
0
 /**
  * @return ICollection
  */
 protected function getCachedCollection()
 {
     $key = spl_object_hash($this->parent->getPreloadContainer()) . '_' . $this->metadata->name;
     $cache = $this->parent->getRepository()->getMapper()->getCollectionCache();
     if (!isset($cache->{$key})) {
         $cache->{$key} = $this->createCollection();
     }
     $this->collection = $cache->{$key};
     return $cache->{$key};
 }
 protected function execute(DbalCollection $collection, IEntity $parent)
 {
     $builder = $collection->getQueryBuilder();
     $preloadIterator = $parent->getPreloadContainer();
     $cacheKey = $this->calculateCacheKey($builder, $preloadIterator, $parent);
     $data =& $this->cacheEntityContainers[$cacheKey];
     if ($data) {
         return $data;
     }
     $values = $preloadIterator ? $preloadIterator->getPreloadValues($this->metadata->name) : [$parent->getRawValue($this->metadata->name)];
     $data = $this->fetch(clone $builder, stripos($cacheKey, 'JOIN') !== FALSE, $values, $preloadIterator);
     return $data;
 }
Пример #3
0
 protected function execute(ICollection $collection, IEntity $parent)
 {
     $collectionMapper = $collection->getCollectionMapper();
     if (!$collectionMapper instanceof CollectionMapper) {
         throw new LogicException();
     }
     $builder = $collectionMapper->getSqlBuilder();
     $preloadIterator = $parent->getPreloadContainer();
     $values = $preloadIterator ? $preloadIterator->getPreloadValues($this->metadata->name) : [$parent->getRawValue($this->metadata->name)];
     $cacheKey = md5($builder->buildSelectQuery() . json_encode($values));
     $data =& $this->cacheEntityContainers[$cacheKey];
     if ($data) {
         return $data;
     }
     $data = $this->fetch(clone $builder, stripos($cacheKey, 'JOIN') !== FALSE, $values);
     return $data;
 }
Пример #4
0
 protected function executeCounts(DbalCollection $collection, IEntity $parent)
 {
     $builder = $collection->getQueryBuilder();
     $preloadIterator = $parent->getPreloadContainer();
     $values = $preloadIterator ? $preloadIterator->getPreloadValues('id') : [$parent->getValue('id')];
     $cacheKey = $this->calculateCacheKey($builder, $values);
     $data =& $this->cacheCounts[$cacheKey];
     if ($data !== NULL) {
         return $data;
     }
     $data = $this->fetchCounts($builder, $values);
     return $data;
 }
 protected function executeCounts(ICollection $collection, IEntity $parent)
 {
     $collectionMapper = $collection->getCollectionMapper();
     if (!$collectionMapper instanceof CollectionMapper) {
         throw new LogicException();
     }
     $builder = $collectionMapper->getSqlBuilder();
     $preloadIterator = $parent->getPreloadContainer();
     $values = $preloadIterator ? $preloadIterator->getPreloadValues('id') : [$parent->id];
     $cacheKey = $this->calculateCacheKey($builder, $values);
     $data =& $this->cacheCounts[$cacheKey];
     if ($data !== NULL) {
         return $data;
     }
     $data = $this->fetchCounts($builder, $values);
     return $data;
 }