Esempio n. 1
0
 /**
  * @param \obo\Interfaces\IPaginator $paginator
  * @param \obo\Interfaces\IFilter $filter
  * @return \obo\Entity[]
  */
 public function getSubset(\obo\Interfaces\IPaginator $paginator, \obo\Interfaces\IFilter $filter = null)
 {
     $specification = new \obo\Carriers\QueryCarrier();
     if ($filter !== null) {
         $specification->addSpecification($filter->getSpecification());
     }
     $paginator->setItemCount($this->countEntities($specification));
     $specification->addSpecification($paginator->getSpecification());
     return $this->find($specification);
 }
Esempio n. 2
0
 /**
  * @param \obo\Interfaces\IQuerySpecification $specification
  * @param \obo\Interfaces\IPaginator $paginator
  * @param \obo\Interfaces\IFilter $filter
  * @return \obo\Entity
  */
 public static function findEntities(\obo\Interfaces\IQuerySpecification $specification, \obo\Interfaces\IPaginator $paginator = null, \obo\Interfaces\IFilter $filter = null)
 {
     $specification = self::queryCarrier()->addSpecification($specification);
     if ($filter !== null) {
         $specification->addSpecification($filter->getSpecification());
     }
     if ($paginator !== null) {
         $paginator->setItemCount(self::countRecords(clone $specification));
         $specification->addSpecification($paginator->getSpecification());
     }
     $classNameEntity = self::classNameManagedEntity();
     $specification->select(self::constructSelect());
     return self::entitiesFromDataStorage($specification);
 }