当前位置: 首页>>代码示例>>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;未经允许,请勿转载。