當前位置: 首頁>>代碼示例>>PHP>>正文


PHP QueryBuilder::getQuery方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\QueryBuilder::getQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP QueryBuilder::getQuery方法的具體用法?PHP QueryBuilder::getQuery怎麽用?PHP QueryBuilder::getQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\QueryBuilder的用法示例。


在下文中一共展示了QueryBuilder::getQuery方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: searchOne

 /**
  * @param ChannelConditionInterface $condition
  * @return ChannelInterface
  */
 public function searchOne(ChannelConditionInterface $condition)
 {
     $this->qb = $this->em->createQueryBuilder();
     $this->qb->select('ch')->from('CoreBundle:Channel', 'ch');
     $this->initQueryBuilder($condition);
     return $this->qb->getQuery()->getOneOrNullResult();
 }
開發者ID:Exanrus,項目名稱:crm-bundle,代碼行數:11,代碼來源:ChannelManager.php

示例2: getData

 /**
  * Get the data
  * @return array
  */
 public function getData()
 {
     /**
      * Paginator is better if the query uses ManyToMany associations
      */
     return $this->data ?: $this->data_source->getQuery()->getResult();
 }
開發者ID:OCC2,項目名稱:occ2pacs,代碼行數:11,代碼來源:DoctrineDataSource.php

示例3: getData

 /**
  * Get the data
  * @return array
  */
 public function getData()
 {
     /**
      * Paginator is better if the query uses ManyToMany associations
      */
     return $this->data ?: $this->data_source->getQuery()->getResult(Doctrine\ORM\Query::HYDRATE_ARRAY);
 }
開發者ID:JakubKontra,項目名稱:datagrid,代碼行數:11,代碼來源:DoctrineDataSource.php

示例4: getEntities

 /**
  * {@inheritdoc}
  */
 public function getEntities()
 {
     $query = $this->queryBuilder->getQuery();
     foreach ($this->hints as $name => $value) {
         $query->setHint($name, $value);
     }
     return $query->execute();
 }
開發者ID:networking,項目名稱:init-cms-bundle,代碼行數:11,代碼來源:ORMQueryBuilderLoader.php

示例5: search

 /**
  * @param CompanyConditionInterface $condition
  * @return Company[]
  */
 public function search(CompanyConditionInterface $condition)
 {
     $this->qb = $this->em->createQueryBuilder();
     $this->qb->select('co')->from('CoreBundle:Company', 'co');
     $this->initQueryBuilder($condition);
     $this->preparePagination($this->qb, $condition);
     return $this->qb->getQuery()->getResult();
 }
開發者ID:Exanrus,項目名稱:crm-bundle,代碼行數:12,代碼來源:CompanyManager.php

示例6: convert

 /**
  * Convert an array of ID's to Doctrine entities / arrays
  *
  * @param  array $data
  * @return array
  */
 public function convert($data)
 {
     if (empty($data)) {
         return array();
     }
     $this->qb->andWhere($this->qb->expr()->in($this->searchfield, $data));
     return $this->qb->getQuery()->getResult();
 }
開發者ID:outeredge,項目名稱:edge-zf2,代碼行數:14,代碼來源:IdToResultConverter.php

示例7: getResults

 /**
  * @return ResultRecordInterface[]
  */
 public function getResults()
 {
     $results = $this->qb->getQuery()->execute();
     $rows = [];
     foreach ($results as $result) {
         $rows[] = new ResultRecord($result);
     }
     return $rows;
 }
開發者ID:alexisfroger,項目名稱:pim-community-dev,代碼行數:12,代碼來源:OrmDatasource.php

示例8: getEntities

 /**
  * {@inheritDoc}
  *
  * This function overwrites the original function to add the "automaticSorting" functionnality
  */
 public function getEntities()
 {
     $entities = $this->queryBuilder->getQuery()->execute();
     // If automaticSorting is On
     if ($this->automaticSorting) {
         // Sort the entities
         $entities = $this->treeEntityOrderer->sortEntities($entities);
     }
     return $entities;
 }
開發者ID:pmdc,項目名稱:UnifikSystemBundle,代碼行數:15,代碼來源:ORMSortedQueryBuilderLoader.php

示例9: getItems

 public function getItems()
 {
     $this->qb->setMaxResults($this->getLimit());
     $this->qb->setFirstResult($this->getOffset());
     list($sortColumn, $sortType) = $this->getSorting();
     if ($sortColumn) {
         $this->qb->orderBy($this->qb->getRootAlias() . "." . $sortColumn, $sortType);
     }
     return $this->qb->getQuery()->getResult();
 }
開發者ID:janmarek,項目名稱:Neuron,代碼行數:10,代碼來源:DoctrineQueryBuilderModel.php

示例10: processQuery

 /**
  * Returns the Query Builder or the results depending on the repository parameters
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder
  * @param bool                       $singleResult
  *
  * @return mixed
  */
 protected function processQuery($queryBuilder, $singleResult = false)
 {
     if ($this->returnQueryBuilder) {
         return $queryBuilder;
     }
     if ($singleResult) {
         return $queryBuilder->getQuery()->getSingleResult();
     }
     return $queryBuilder->getQuery()->getResult();
 }
開發者ID:pmdc,項目名稱:UnifikSystemBundle,代碼行數:18,代碼來源:BaseEntityRepository.php

示例11: getResults

 /**
  * @return ResultRecordInterface[]
  */
 public function getResults()
 {
     $query = $this->aclHelper->apply($this->qb->getQuery());
     $results = $query->execute();
     $rows = [];
     foreach ($results as $result) {
         $rows[] = new ResultRecord($result);
     }
     return $rows;
 }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:13,代碼來源:OrmDatasource.php

示例12: processOrderByForList

 protected function processOrderByForList(QueryBuilder $qb, $orderBy)
 {
     $fieldName = is_array($orderBy) ? key($orderBy) : $orderBy;
     $order = is_array($orderBy) ? $orderBy[$fieldName] : 'ASC';
     if (in_array($fieldName, ['visits', 'visitsCount', 'visitCount'])) {
         $qb->addSelect('COUNT(v) AS totalVisits')->leftJoin('s.visits', 'v')->groupBy('s')->orderBy('totalVisits', $order);
         return array_column($qb->getQuery()->getResult(), 0);
     } elseif (in_array($fieldName, ['originalUrl', 'shortCode', 'dateCreated'])) {
         $qb->orderBy('s.' . $fieldName, $order);
     }
     return $qb->getQuery()->getResult();
 }
開發者ID:shlinkio,項目名稱:shlink,代碼行數:12,代碼來源:ShortUrlRepository.php

示例13: loadEntities

 protected function loadEntities()
 {
     if ($this->query) {
         $items = $this->query->getQuery()->getResult();
     } else {
         $meta = $this->form->mapper->entityManager->getClassMetadata(get_class($this->parent->data));
         if (!$meta->hasAssociation($this->name)) {
             throw new Nette\InvalidStateException();
         }
         $class = $meta->associationMappings[$this->name]['targetEntity'];
         $items = $this->getParent()->form->mapper->entityManager->getRepository($class)->findBy($this->criteria, $this->orderBy, $this->limit, $this->offset);
     }
     $this->setItems($items);
 }
開發者ID:svobodni,項目名稱:web,代碼行數:14,代碼來源:ManyToOne.php

示例14: getData

 public function getData(array $p_params, array $p_cols)
 {
     $this->_queryObject = $this->_repository->createQueryBuilder('e');
     // search
     if (!empty($p_params['search'])) {
         $this->search($p_params['search'], $p_cols);
     }
     // sort
     if (@count($p_params['sortCol'])) {
         $this->sort($p_params, $p_cols);
     }
     // limit
     $this->_queryObject->setFirstResult((int) $p_params['displayStart'])->setMaxResults((int) $p_params['displayLength']);
     return $this->_queryObject->getQuery()->getResult();
 }
開發者ID:sourcefabric,項目名稱:newscoop,代碼行數:15,代碼來源:Doctrine.php

示例15: getResults

 /**
  * @return ResultRecordInterface[]
  */
 public function getResults()
 {
     $query = $this->qb->getQuery();
     $this->setQueryHints($query);
     $event = new OrmResultBefore($this->datagrid, $query);
     $this->eventDispatcher->dispatch(OrmResultBefore::NAME, $event);
     $results = $event->getQuery()->execute();
     $rows = [];
     foreach ($results as $result) {
         $rows[] = new ResultRecord($result);
     }
     $event = new OrmResultAfter($this->datagrid, $rows);
     $this->eventDispatcher->dispatch(OrmResultAfter::NAME, $event);
     return $event->getRecords();
 }
開發者ID:nmallare,項目名稱:platform,代碼行數:18,代碼來源:OrmDatasource.php


注:本文中的Doctrine\ORM\QueryBuilder::getQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。