コード例 #1
0
ファイル: Command.php プロジェクト: kalvisbuls/analogue
 public function __construct(Mappable $entity, Mapper $mapper, QueryAdapter $query)
 {
     $this->entity = $entity;
     $this->mapper = $mapper;
     $this->entityState = new StateChecker($entity, $mapper);
     $this->entityMap = $mapper->getEntityMap();
     $this->query = $query->from($this->entityMap->getTable());
 }
コード例 #2
0
ファイル: Query.php プロジェクト: maxmirazh33/analogue
 /**
  * Get the hydrated models without eager loading.
  *
  * @param  array  $columns
  * @return Analogue\ORM\EntityCollection
  */
 public function getEntities($columns = array('*'))
 {
     // As we need the primary key to feed the
     // entity cache, we need it loaded on each
     // request
     $columns = $this->enforceIdColumn($columns);
     // Run the query
     $results = $this->query->get($columns);
     $builder = new EntityBuilder($this->mapper, array_keys($this->getEagerLoads()));
     return $builder->build($results);
 }