Exemplo n.º 1
0
 /**
  * @param Criteria $criteria
  *
  * @return IndexAction
  */
 public function setCriteria(Criteria $criteria)
 {
     $filters = $criteria->getFilters();
     $filters['owner'] = $this->user;
     $criteria = new Criteria($filters, $criteria->getCount(), $criteria->getPage(), $criteria->getOrderBy());
     return parent::setCriteria($criteria);
 }
 /**
  * @param Criteria $criteria
  *
  * @return IndexAction
  */
 public function setCriteria(Criteria $criteria)
 {
     $order = $this->orderRepository->findActive();
     $filters = $criteria->getFilters();
     $filters['order'] = $order;
     $criteria = new Criteria($filters, $criteria->getCount(), $criteria->getPage(), $criteria->getOrderBy());
     return parent::setCriteria($criteria);
 }
Exemplo n.º 3
0
 public function findByCriteria(Criteria $criteria)
 {
     $builder = $this->createQueryBuilder('t');
     $orderBy = $criteria->getOrderBy();
     if (null !== $orderBy) {
         foreach ($orderBy as $field => $order) {
             $builder->addOrderBy('t.' . $field, $order);
         }
     }
     $builder->setMaxResults($criteria->getCount());
     $offset = ($criteria->getPage() - 1) * $criteria->getCount();
     $builder->setFirstResult($offset);
     $query = $builder->getQuery();
     return $query->execute();
 }