Example #1
0
 public function itemsInCategory(Category $category, $type, User $userFrom)
 {
     return $this->createQueryBuilder('i')->select('i')->andWhere('i.deleted = 0')->andWhere('i.completed = 0')->andWhere('i.type = :type')->setParameter('type', $type)->leftJoin('i.category', 'c', 'i.category == c.id')->leftJoin('AppBundle\\Entity\\Distance', 'd')->andWhere('c.lft >= :categoryLft')->setParameter('categoryLft', $category->getLeftValue())->andWhere('c.rgt <= :categoryRgt')->setParameter('categoryRgt', $category->getRightValue())->andWhere('c.root = :categoryRoot')->setParameter('categoryRoot', $category->getRootValue())->setMaxResults(14)->orderBy('i.id', 'DESC')->getQuery()->getResult();
 }