Esempio n. 1
0
 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());
 }
Esempio n. 2
0
 /**
  * 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);
 }