當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。