/** * @param Kdyby\Persistence\Queryable|Kdyby\Doctrine\EntityDao $repository * @return Kdyby\Doctrine\NativeQueryBuilder */ private function createBasicDql(Kdyby\Persistence\Queryable $repository) { $qb = (new QueryBuilder($repository->getEntityManager()))->select('partial l.{id, description, year, month}')->from(Listing::class, 'l')->leftJoin(ListingItem::class, 'li WITH li.listing = l')->leftJoin('li.workedHours', 'wh'); foreach ($this->filter as $modifier) { $modifier($qb); } return $qb; }
protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { $qb = $repository->createQueryBuilder()->select('a, b, c, d')->from(Model\CMS\Entity\Article::getClassName(), 'a')->leftJoin('a.category', 'b')->leftJoin('a.tags', 'c')->leftJoin('a.authors', 'd'); $this->applyFilters($qb); $qb->addOrderBy('a.createdAt', 'DESC'); $query = $qb->getQuery()->useResultCache(TRUE, NULL, Model\CMS\Service\ArticleService::CACHE_TAG); return $query; }
/** * @param Queryable $repository * @return QueryBuilder */ protected function doCreateQuery(Queryable $repository) { $queryBuilder = $repository->createQueryBuilder()->select('s')->from(ScopeEntity::class, 's'); foreach ($this->filters as $filter) { $filter($queryBuilder); } return $queryBuilder; }
/** * @param Kdyby\Persistence\Queryable|Kdyby\Doctrine\EntityDao $repository * @return Kdyby\Doctrine\NativeQueryBuilder */ private function createBasicDql(Kdyby\Persistence\Queryable $repository) { $this->queryBuilder = (new QueryBuilder($repository->getEntityManager()))->select('i')->from(Invitation::class, 'i'); foreach ($this->filter as $modifier) { $modifier($this->queryBuilder); } return $this->queryBuilder; }
/** * @param Queryable|Kdyby\Doctrine\EntityDao $repository * @return NativeQueryBuilder */ private function createBasicDql(Queryable $repository) { $qb = $repository->createQueryBuilder('Search'); foreach ($this->filter as $modifier) { $modifier($qb); } return $qb; }
protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { $qb = $this->createBasicQuery($repository->getEntityManager()); $qb->select('c')->orderBy('c.id'); foreach ($this->select as $modifier) { $modifier($qb); } return $qb; }
protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { $qb = $repository->createQueryBuilder()->select('a.slug, a.firstName, a.surname, a.perex, a.image, COUNT(b) AS countArticles')->from(Model\CMS\Entity\Author::getClassName(), 'a')->leftJoin('a.articles', 'b')->groupBy('a.id')->addOrderBy('a.surname', 'ASC'); //->addOrderBy('countArticles', 'DESC') //->addOrderBy('a.id', 'DESC'); $this->applyFilters($qb); $query = $qb->getQuery()->useResultCache(TRUE, NULL, Model\CMS\Service\ArticleService::CACHE_TAG); return $query; }
protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { $qb = $this->createBasicQuery($repository->getEntityManager()); $qb->innerJoin('a.resource', 'r')->innerJoin('a.privilege', 'p')->select('a, r, p')->orderBy('a.resource'); foreach ($this->select as $modifier) { $modifier($qb); } return $qb; }
protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { $qb = $repository->createQueryBuilder()->select('perm', 'res', 'priv')->from(Model\CMS\Entity\Permission::getClassName(), 'perm')->join('perm.resource', 'res')->join('perm.privilege', 'priv')->orderBy('res.id, priv.id'); $this->applyFilters($qb); $query = $qb->getQuery()->useResultCache(TRUE, NULL, Model\CMS\AclFactory::CACHE_TAG); $query->setHint(Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'); $query->setHint(Gedmo\Translatable\TranslatableListener::HINT_TRANSLATABLE_LOCALE, $this->locale); return $query; }
/** * @param \Kdyby\Persistence\Queryable $repository * @return \Doctrine\ORM\Query|\Doctrine\ORM\QueryBuilder */ protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { $qb = $this->getBasicDQL($repository->getEntityManager()); $qb->select('i'); $qb->addOrderBy('i.uploadedAt', 'DESC'); foreach ($this->select as $modifier) { $modifier($qb); } return $qb; }
/** * @param \Kdyby\Persistence\Queryable $repository * @return \Doctrine\ORM\Query|\Doctrine\ORM\QueryBuilder */ protected function doCreateQuery(Queryable $repository) { $qb = $repository->createQueryBuilder()->select('a')->from('App\\Entity', 'a'); if ($this->_doCreateQuery) { call_user_func($this->_doCreateQuery, $qb); } else { $this->applyAllFilters($qb); } return $qb; }
protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { $qb = $repository->createQueryBuilder()->select('a, b, c')->from(Model\CMS\Entity\User::getClassName(), 'a')->join('a.role', 'b')->join('a.login', 'c'); $this->applyFilters($qb); $query = $qb->getQuery()->useResultCache(TRUE, NULL, Model\CMS\AclFactory::CACHE_TAG); if ($this->locale !== NULL) { $query->setHint(Gedmo\Translatable\TranslatableListener::HINT_TRANSLATABLE_LOCALE, $this->locale); } return $query; }
protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { $qb = $repository->createQueryBuilder()->select('a')->from(Model\CMS\Entity\Page::getClassName(), 'a'); $this->applyFilters($qb); return $qb->getQuery()->useResultCache(TRUE, NULL, Model\CMS\Service\PageService::CACHE_TAG); }
/** @inherit */ protected function doCreateQuery(Kdyby\Persistence\Queryable $repository) { return $repository->select('user')->where('name = :nameOrEmail OR email = :nameOrEmail')->setParameter('nameOrEmail', $this->nameOrEmail); }
/** * @param Queryable $repository * @return QueryBuilder */ protected function doCreateQuery(Queryable $repository) { return $repository->createQueryBuilder('screenplay')->select('partial screenplay.{id}')->innerJoin('screenplay.episode', 'episode')->innerJoin('episode.season', 'season')->andWhere('season.language = :language')->setParameter('language', $this->language)->andWhere('screenplay.character IS NOT NULL'); }
/** * @param Kdyby\Persistence\Queryable|Kdyby\Doctrine\EntityDao $repository * @return Kdyby\Doctrine\NativeQueryBuilder */ private function createBasicDql(Kdyby\Persistence\Queryable $repository) { $this->queryBuilder = (new QueryBuilder($repository->getEntityManager()))->select('sm')->from(SentMessage::class, 'sm')->orderBy('sm.id', 'DESC'); foreach ($this->filter as $modifier) { $modifier($this->queryBuilder); } return $this->queryBuilder; }