getRepository() public method

Returns entity repository.
public getRepository ( boolean $need = true ) : Nextras\Orm\Repository\IRepository | null
$need boolean
return Nextras\Orm\Repository\IRepository | null
Beispiel #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};
 }
 /**
  * @param  string   $collectionName
  * @return ICollection
  */
 protected function getCachedCollection($collectionName)
 {
     $key = $this->metadata->name . '_' . $collectionName;
     $cache = $this->parent->getRepository()->getMapper()->getCollectionCache();
     if (isset($cache->{$key})) {
         return $cache->{$key};
     }
     if ($collectionName !== NULL) {
         $filterMethod = 'filter' . $collectionName;
         $cache->{$key} = call_user_func([$this->parent, $filterMethod], $this->createCollection());
     } else {
         $cache->{$key} = $this->createCollection();
     }
     return $cache->{$key};
 }
Beispiel #3
0
 public function attach(IEntity $entity)
 {
     if (!$entity->getRepository(FALSE)) {
         $this->identityMap->attach($entity);
         if ($this->dependencyProvider) {
             $this->dependencyProvider->injectDependencies($entity);
         }
     }
 }