Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function count()
 {
     $criteria = clone $this->criteria;
     $criteria->setFirstResult(null);
     $criteria->setMaxResults(null);
     return count($this->selectable->matching($criteria));
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getSlice($offset, $length)
 {
     $firstResult = $offset;
     $maxResults = $length;
     $criteria = $this->createCriteria($firstResult, $maxResults);
     return $this->selectable->matching($criteria);
 }
 /**
  * {@inheritdoc}
  */
 public function getData(RequestInterface $request)
 {
     $criteria = new Criteria();
     $criteria->setMaxResults($request->getLimit());
     $criteria->setFirstResult($request->getOffset());
     $this->processOrder($criteria, $request);
     $this->processSearch($criteria, $request);
     $this->processGlobalSearch($criteria, $request);
     $result = $this->collection->matching($criteria);
     return $this->processData($result);
 }
 /**
  * {@inheritdoc}
  */
 public function getTotal(RequestInterface $request)
 {
     $criteria = new Criteria();
     $this->processOrder($criteria, $request);
     $this->processSearch($criteria, $request);
     $this->processGlobalSearch($criteria, $request);
     return $this->collection->matching($criteria)->count();
 }
Exemplo n.º 5
0
 /**
  * Finds a data entity
  *
  * @param string $key
  *
  * @return object|null
  */
 protected function findData($key)
 {
     $criteria = Criteria::create()->where(Criteria::expr()->eq('key', $key));
     $result = $this->data->matching($criteria);
     if (is_array($result)) {
         $result = reset($result);
         return $result;
     }
 }
Exemplo n.º 6
0
 /**
  * @param  int $id
  * @return Post
  */
 public function get($id)
 {
     return $this->posts->matching(Criteria::create()->where(Criteria::expr()->eq('id', $id)))->first();
 }