示例#1
0
文件: Query.php 项目: zaxxx/zaxcms
 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;
 }
示例#2
0
文件: Service.php 项目: zaxxx/zaxcms
 public function __construct(Kdyby\Doctrine\EntityManager $entityManager)
 {
     parent::__construct($entityManager);
     $this->entityClassName = Entity\Author::getClassName();
 }