当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityRepository::createQueryBuilder方法代码示例

本文整理汇总了PHP中Doctrine\ORM\EntityRepository::createQueryBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityRepository::createQueryBuilder方法的具体用法?PHP EntityRepository::createQueryBuilder怎么用?PHP EntityRepository::createQueryBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\EntityRepository的用法示例。


在下文中一共展示了EntityRepository::createQueryBuilder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildBaseQuery

 /**
  * @return QueryBuilder
  */
 private function buildBaseQuery()
 {
     $qb = $this->entityRepository->createQueryBuilder('z');
     GathererHelper::addFiltersDataToQuery($this->filters, $qb);
     GathererHelper::addAdditionalFilterDataToQuery($this->additionalFilters, $qb);
     return $qb;
 }
开发者ID:amstaffix,项目名称:extjs-entity-gatherer,代码行数:10,代码来源:Gatherer.php

示例2: findTopicsByCategory

 /**
  * {@inheritDoc}
  */
 public function findTopicsByCategory(CategoryInterface $category, $page = 0)
 {
     $qb = $this->repository->createQueryBuilder('t')->select('t, c, u')->join('t.category', 'c')->join('t.user', 'u')->where('c.id = :category')->andWhere('t.isDeleted = 0')->orderBy('t.lastPost', 'desc')->setParameter('category', $category->getId());
     $pager = new Pager(new ProxyQuery($qb));
     $pager->setPage($page);
     return $pager;
 }
开发者ID:qushe-demon,项目名称:ghost,代码行数:10,代码来源:TopicManager.php

示例3: findPostsByTopic

 /**
  * {@inheritDoc}
  */
 public function findPostsByTopic(TopicInterface $topic, $page = 1)
 {
     $qb = $this->repository->createQueryBuilder('p')->select('p, t, u')->join('p.topic', 't')->join('p.user', 'u')->where('t.id = :topic')->andWhere('p.isDeleted = 0')->orderBy('p.created', 'asc')->setParameter('topic', $topic->getId());
     $pager = new Pager(new ProxyQuery($qb));
     $pager->setLimit(25)->setPage($page);
     return $pager;
 }
开发者ID:qushe-demon,项目名称:ghost,代码行数:10,代码来源:PostManager.php

示例4: addFilterByOrderStatus

 /**
  * @param QueryBuilder $qb
  * @param string       $orderStatus
  */
 protected function addFilterByOrderStatus(QueryBuilder $qb, $orderStatus)
 {
     $aliases = $qb->getRootAliases();
     $subQueryBuilder = $this->customerRepository->createQueryBuilder('c');
     $subQueryBuilder->select('IDENTITY(c.account)')->join('c.orders', 'o', 'WITH', $subQueryBuilder->expr()->eq($subQueryBuilder->expr()->lower('o.status'), ':filteredOrderStatus'));
     $qb->andWhere($qb->expr()->in($aliases[0] . '.account', $subQueryBuilder->getDQL()))->setParameter('filteredOrderStatus', $orderStatus);
 }
开发者ID:antrampa,项目名称:crm,代码行数:11,代码来源:UpdateCustomerLifetimeForCanceledOrders.php

示例5: createQueryBuilder

 public function createQueryBuilder($alias = null, $indexBy = null)
 {
     if ($alias === null) {
         $alias = $this->getName();
     }
     return $this->baseRepository->createQueryBuilder($alias, $indexBy);
 }
开发者ID:mikegibson,项目名称:sentient,代码行数:7,代码来源:ManagedRepository.php

示例6: findTextBySlugAndLocale

 /**
  * {@inheritdoc}
  */
 public function findTextBySlugAndLocale($slug, $locale)
 {
     $qb = $this->repository->createQueryBuilder('text');
     $qb->innerJoin('text.translations', 'translation', Join::WITH, $qb->expr()->eq('translation.lang', ':locale'))->setParameter('locale', $locale);
     $qb->andWhere($qb->expr()->eq('text.slug', ':slug'))->setParameter('slug', $slug);
     $qb->select('text, translation');
     return $qb->getQuery()->getOneOrNullResult();
 }
开发者ID:silvestra,项目名称:silvestra,代码行数:11,代码来源:TextManager.php

示例7: getBaseQuery

 /**
  * Возвращает базовый запрос на выборку
  * @return \Doctrine\ORM\QueryBuilder
  */
 private function getBaseQuery()
 {
     $result = $this->entityRepository->createQueryBuilder('currency');
     if ($this->limit) {
         $result->setMaxResults($this->limit);
     }
     return $result;
 }
开发者ID:nikolaykovenko,项目名称:usd-course-graph,代码行数:12,代码来源:CourseGraphPresenter.php

示例8: renderBlock

 /**
  * @param \Twig_Environment $twig
  * @param string $alias
  * @return \Twig_Template
  * @throws \InvalidArgumentException
  */
 public function renderBlock(\Twig_Environment $twig, $alias)
 {
     $block = $this->repo->createQueryBuilder('b')->where('b.alias = :alias')->setParameters(compact('alias'))->setMaxResults(1)->getQuery()->useResultCache(true)->setResultCacheId('cms_block.' . $alias)->getResult();
     $block = current($block);
     if (!$block) {
         throw new \InvalidArgumentException(sprintf("CMS block '%s' could not be found", $alias));
     }
     return $twig->createTemplate($block->getContent());
 }
开发者ID:vaidasif,项目名称:symfony-force,代码行数:15,代码来源:CMSBlockExtension.php

示例9: getQuery

 /**
  * {@inheritdoc}
  */
 public function getQuery()
 {
     if (!$this->query) {
         $qb = $this->categoryRepository->createQueryBuilder('c');
         $qb->orderBy('c.root')->addOrderBy('c.left');
         $this->query = $qb->getQuery();
     }
     return $this->query;
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:12,代码来源:CategoryReader.php

示例10: find

 /**
  * {@inheritdoc}
  */
 public function find()
 {
     $qb = $this->repository->createQueryBuilder('s');
     $qb->leftJoin('s.seoMetadata', 'sm');
     $qb->setMaxResults(1);
     $qb->select('s, sm');
     $q = $qb->getQuery();
     $q->useResultCache(true, 3600, SiteInterface::SITE);
     return $q->getOneOrNullResult();
 }
开发者ID:silvestra,项目名称:silvestra,代码行数:13,代码来源:SiteManager.php

示例11: findVisible

 public function findVisible($organizer)
 {
     if (!$organizer instanceof UserInterface) {
         $organizer = null;
     }
     $qb = $this->repo->createQueryBuilder('e');
     $qb->join('e.calendar', 'c')->andWhere('e.organizer = :organizer')->orWhere('c.visibility = :calendarVisibility');
     $qb->setParameters(array('organizer' => $organizer, 'calendarVisibility' => CalendarInterface::VISIBILITY_PUBLIC));
     return $qb->getQuery()->execute();
 }
开发者ID:pguso,项目名称:CalendarBundle,代码行数:10,代码来源:EventManager.php

示例12: testApply

 /**
  * @dataProvider provideApplyTestData
  */
 public function testApply($properties, array $filterParameters, string $expected)
 {
     $request = Request::create('/api/dummies', 'GET', $filterParameters);
     $requestStack = new RequestStack();
     $requestStack->push($request);
     $queryBuilder = $this->repository->createQueryBuilder('o');
     $filter = new NumericFilter($this->managerRegistry, $requestStack, null, $properties);
     $filter->apply($queryBuilder, new QueryNameGenerator(), $this->resourceClass);
     $actual = $queryBuilder->getQuery()->getDQL();
     $this->assertEquals($expected, $actual);
 }
开发者ID:api-platform,项目名称:core,代码行数:14,代码来源:NumericFilterTest.php

示例13: findCommentTreeByCommentId

 /**
  * {@inheritdoc}
  */
 public function findCommentTreeByCommentId($commentId, $sorter = null)
 {
     $qb = $this->repository->createQueryBuilder('c');
     $qb->join('c.thread', 't')->where('LOCATE(:path, CONCAT(\'/\', CONCAT(c.ancestors, \'/\'))) > 0')->orderBy('c.ancestors', 'ASC')->setParameter('path', "/{$commentId}/");
     $comments = $qb->getQuery()->execute();
     if (!$comments) {
         return array();
     }
     $sorter = $this->sortingFactory->getSorter($sorter);
     $trimParents = current($comments)->getAncestors();
     return $this->organiseComments($comments, $sorter, $trimParents);
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:15,代码来源:CommentManager.php

示例14: findNodeAllChildrenTranslationsByLang

 /**
  * {@inheritdoc}
  */
 public function findNodeAllChildrenTranslationsByLang(NodeInterface $node, $lang)
 {
     $qb = $this->repository->createQueryBuilder('t');
     $qb->innerJoin('t.node', 'n');
     $qb->andWhere($qb->expr()->eq('t.lang', ':locale'));
     $qb->setParameter('locale', $lang);
     $qb->andWhere($qb->expr()->eq('n.root', ':root'))->setParameter('root', $node->getRoot());
     $qb->andWhere($qb->expr()->gte('n.left', ':left'))->setParameter('left', $node->getLeft());
     $qb->andWhere($qb->expr()->lte('n.right', ':right'))->setParameter('right', $node->getRight());
     $qb->select('t');
     return $qb->getQuery()->getResult();
 }
开发者ID:aistis-,项目名称:SitemapBundle,代码行数:15,代码来源:NodeTranslationManager.php

示例15: findExistingNodeTypes

 /**
  * {@inheritdoc}
  */
 public function findExistingNodeTypes(TreeInterface $tree)
 {
     $qb = $this->repository->createQueryBuilder('n');
     $qb->andWhere($qb->expr()->eq('n.tree', ':tree'))->setParameter('tree', $tree);
     $qb->andWhere($qb->expr()->isNotNull('n.type'));
     $qb->select('DISTINCT n.type');
     $result = array();
     foreach ($qb->getQuery()->getResult() as $row) {
         $result[] = $row['type'];
     }
     return $result;
 }
开发者ID:aistis-,项目名称:SitemapBundle,代码行数:15,代码来源:NodeManager.php


注:本文中的Doctrine\ORM\EntityRepository::createQueryBuilder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。