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


PHP Paginator::setUseOutputWalkers方法代码示例

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


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

示例1: getResult

 /**
  * {@inheritdoc}
  */
 public function getResult(QueryBuilder $queryBuilder)
 {
     $doctrineOrmPaginator = new DoctrineOrmPaginator($queryBuilder);
     // Disable output walkers by default (performance)
     $doctrineOrmPaginator->setUseOutputWalkers(false);
     return new Paginator($doctrineOrmPaginator);
 }
开发者ID:rolebi,项目名称:DunglasApiBundle,代码行数:10,代码来源:PaginationExtension.php

示例2: getCount

 /**
  * Calculates total count of query records
  * Notes: this method do not make any modifications of the given query
  *
  * @param Query|SqlQuery $query
  *
  * @return integer
  */
 public function getCount($query)
 {
     if ($this->useWalker($query)) {
         if (!$query->contains('DISTINCT')) {
             $query->setHint(CountWalker::HINT_DISTINCT, false);
         }
         $paginator = new Paginator($query);
         $paginator->setUseOutputWalkers(false);
         $result = $paginator->count();
     } else {
         if ($query instanceof Query) {
             $parserResult = QueryUtils::parseQuery($query);
             $parameterMappings = $parserResult->getParameterMappings();
             list($params, $types) = QueryUtils::processParameterMappings($query, $parameterMappings);
             $statement = $query->getEntityManager()->getConnection()->executeQuery('SELECT COUNT(*) FROM (' . $query->getSQL() . ') AS e', $params, $types);
         } elseif ($query instanceof SqlQuery) {
             $countQuery = clone $query->getQueryBuilder();
             $statement = $countQuery->resetQueryParts()->select('COUNT(*)')->from('(' . $query->getSQL() . ')', 'e')->execute();
         } else {
             throw new \InvalidArgumentException(sprintf('Expected instance of Doctrine\\ORM\\Query or Oro\\Bundle\\EntityBundle\\ORM\\SqlQuery, "%s" given', is_object($query) ? get_class($query) : gettype($query)));
         }
         $result = $statement->fetchColumn();
     }
     return $result ? (int) $result : 0;
 }
开发者ID:northdakota,项目名称:platform,代码行数:33,代码来源:QueryCountCalculator.php

示例3: items

 public function items(ItemsEvent $event)
 {
     if (!class_exists('Doctrine\\ORM\\Tools\\Pagination\\Paginator')) {
         return;
     }
     if (!$event->target instanceof Query) {
         return;
     }
     $event->stopPropagation();
     $useOutputWalkers = false;
     if (isset($event->options['wrap-queries'])) {
         $useOutputWalkers = $event->options['wrap-queries'];
     }
     $event->target->setFirstResult($event->getOffset())->setMaxResults($event->getLimit())->setHint(CountWalker::HINT_DISTINCT, $event->options['distinct']);
     $fetchJoinCollection = true;
     if ($event->target->hasHint(self::HINT_FETCH_JOIN_COLLECTION)) {
         $fetchJoinCollection = $event->target->getHint(self::HINT_FETCH_JOIN_COLLECTION);
     }
     $paginator = new Paginator($event->target, $fetchJoinCollection);
     $paginator->setUseOutputWalkers($useOutputWalkers);
     if (($count = $event->target->getHint(QuerySubscriber::HINT_COUNT)) !== false) {
         $event->count = intval($count);
     } else {
         $event->count = count($paginator);
     }
     $event->items = iterator_to_array($paginator);
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:27,代码来源:UsesPaginator.php

示例4: paginate

 public function paginate(QueryBuilder $query, $limit, $page)
 {
     $query->setMaxResults($limit)->setFirstResult($limit * ($page - 1));
     $paginator = new Paginator($query->getQuery());
     $paginator->setUseOutputWalkers(false);
     return $paginator;
 }
开发者ID:jacksleight,项目名称:coast-doctrine,代码行数:7,代码来源:EntityManager.php

示例5: getQueryResult

 public function getQueryResult($class, $params)
 {
     if (!$params instanceof OdataParameters) {
         $params = OdataParameters::parse($params);
     }
     $repository = $this->entityManager->getRepository($class);
     $queryBuilder = $repository->createQueryBuilder('X');
     $odataBuilder = new OdataQueryBuilderWrapper($queryBuilder);
     $odataBuilder->applyOdataParameters($params);
     if ($params->inlinecount) {
         //            $count = $odataBuilder->getInlineCount();
     }
     $query = $queryBuilder->getQuery();
     $inlineCount = null;
     $fetchJoinCollection = isset($params->expand);
     $fetchCount = $params->inlinecount;
     if ($fetchJoinCollection || $fetchCount) {
         $paginator = new Paginator($query, $fetchJoinCollection);
         $paginator->setUseOutputWalkers(false);
         if ($fetchCount) {
             $inlineCount = count($paginator);
         }
         $result = array();
         foreach ($paginator as $object) {
             $result[] = $object;
         }
     } else {
         $result = $query->getResult();
     }
     if ($inlineCount !== null) {
         return array('Results' => $result, 'InlineCount' => $inlineCount);
     }
     return $result;
 }
开发者ID:popovsergiy,项目名称:breeze.server.php,代码行数:34,代码来源:QueryService.php

示例6: getListagem

 public function getListagem($arrData = array(), $intPage = 1, $intQtdPage = 10)
 {
     $queryBuilder = $this->_em->createQueryBuilder();
     $queryBuilder->select('PessoaFisica')->addSelect('Login.dsLogin')->from('Application\\Entity\\PessoaFisica', 'PessoaFisica')->innerJoin('Application\\Entity\\Login', 'Login', 'with', 'Login.idPessoaFisica = PessoaFisica.idPessoaFisica')->setMaxResults($intQtdPage)->setFirstResult($intPage * ($intPage - 1))->orderBy('PessoaFisica.dsNome', 'asc');
     # bind nome
     if ($arrData['dsNome']) {
         $queryBuilder->andWhere($queryBuilder->expr()->like('PessoaFisica.dsNome', ':dsNome'))->setParameter('dsNome', '%' . $arrData['dsNome'] . '%');
     }
     # bind cpf
     if ($arrData['dsCpf']) {
         $queryBuilder->andWhere('PessoaFisica.dsCpf = :dsCpf')->setParameter('dsCpf', Format::clearCpfCnpj($arrData['dsCpf']));
     }
     # bind dsEmail
     if ($arrData['dsEmail']) {
         $queryBuilder->andWhere('PessoaFisica.dsEmail = :dsEmail')->setParameter('dsEmail', $arrData['dsEmail']);
     }
     # bind dsLogin
     if ($arrData['dsLogin']) {
         $queryBuilder->andWhere('Login.dsLogin = :dsLogin')->setParameter('dsLogin', $arrData['dsLogin']);
     }
     $query = $queryBuilder->getQuery();
     $registerPaginator = new Paginator($query);
     $registerPaginator->setUseOutputWalkers(false);
     $intCountResult = $registerPaginator->count();
     $arrDadosPaginator = array('qtdRegister' => $intCountResult, 'qtdPages' => ceil($intCountResult / $intQtdPage), 'pageActual' => $intPage, 'maxResult' => $intQtdPage, 'register' => $registerPaginator);
     return $arrDadosPaginator;
 }
开发者ID:ualisonaguiar,项目名称:shome2,代码行数:27,代码来源:PessoaFisicaRepository.php

示例7: getLatestModerations

 /**
  * Get the latest moderation actions
  *
  * @param  integer  $offset
  * @param  integer  $limit
  *
  * @return Paginator
  */
 public function getLatestModerations($offset, $limit)
 {
     $queryBuilder = $this->createQueryBuilder('mo')->select(array('mo', 'u', 'f', 'm', 't', 'b'))->join('mo.user', 'u')->leftJoin('mo.flag', 'f')->leftJoin('mo.message', 'm')->leftJoin('mo.topic', 't')->leftJoin('mo.board', 'b')->orderBy('mo.id', 'DESC');
     $query = $queryBuilder->getQuery();
     $query->setFirstResult($offset)->setMaxResults($limit);
     $paginator = new Paginator($query, false);
     return $paginator->setUseOutputWalkers(false);
 }
开发者ID:teapotio,项目名称:teapotio-forum,代码行数:16,代码来源:ModerationRepository.php

示例8: getLatestTopicsByBoard

 public function getLatestTopicsByBoard(BoardInterface $board, $offset, $limit, $isDeleted)
 {
     $queryBuilder = $this->createQueryBuilder('t')->select(array('t'))->where('t.board = :board')->setParameter('board', $board)->addOrderBy('t.isPinned', 'DESC')->addOrderBy('t.lastMessageDate', 'DESC');
     if ($isDeleted !== null) {
         $queryBuilder->andWhere('t.isDeleted = :isDeleted')->setParameter('isDeleted', $isDeleted);
     }
     $query = $queryBuilder->getQuery()->setFirstResult($offset)->setMaxResults($limit);
     $paginator = new Paginator($query, false);
     return $paginator->setUseOutputWalkers(false);
 }
开发者ID:teapotio,项目名称:teapotio-forum,代码行数:10,代码来源:TopicRepository.php

示例9: getTotalCount

 public function getTotalCount() : int
 {
     $queryBuilder = $this->getQueryBuilder();
     $query = $queryBuilder->getQuery();
     $query->useQueryCache(true);
     $query->useResultCache(true);
     $paginator = new Paginator($query, true);
     $paginator->setUseOutputWalkers(false);
     return $paginator->count();
 }
开发者ID:wellcommerce,项目名称:wellcommerce,代码行数:10,代码来源:EntityRepository.php

示例10: listCompanies

 public function listCompanies($page = 1, $pageSize = 20)
 {
     $query = $this->em->createQuery('SELECT c, cls FROM SSEICSSBundle:Company c LEFT JOIN c.class cls ORDER BY c.id ASC');
     $paginator = new Paginator($query);
     $paginator->setUseOutputWalkers(false);
     $totalRecruits = count($paginator);
     $pagesCount = ceil($totalRecruits / $pageSize);
     $paginator->getQuery()->setFirstResult($pageSize * ($page - 1))->setMaxResults($pageSize);
     $list = $query->getArrayResult();
     return ["totalRecruits" => $totalRecruits, "currentPage" => $page, "pagesCount" => $pagesCount, "list" => $list];
 }
开发者ID:TJUSSE,项目名称:ICSS,代码行数:11,代码来源:CompanyService.php

示例11: getListagem

 public function getListagem($arrData = array(), $intPage = 1, $intQtdPage = 10)
 {
     $queryBuilder = $this->_em->createQueryBuilder();
     $queryBuilder->select('Empreendimento')->from('Application\\Entity\\Empreendimento', 'Empreendimento')->innerJoin('Application\\Entity\\Municipio', 'Municipio', 'with', 'Municipio.idMunicipio = Empreendimento.idMunicipio')->innerJoin('Application\\Entity\\Estado', 'Estado', 'with', 'Estado.idEstado = Municipio.idEstado')->setMaxResults($intQtdPage)->setFirstResult($intPage * ($intPage - 1))->orderBy('Empreendimento.dsEmpreendimento', 'asc');
     $query = $queryBuilder->getQuery();
     $registerPaginator = new Paginator($query);
     $registerPaginator->setUseOutputWalkers(false);
     $intCountResult = $registerPaginator->count();
     $arrDadosPaginator = array('qtdRegister' => $intCountResult, 'qtdPages' => ceil($intCountResult / $intQtdPage), 'pageActual' => $intPage, 'maxResult' => $intQtdPage, 'register' => $registerPaginator);
     return $arrDadosPaginator;
 }
开发者ID:ualisonaguiar,项目名称:shome2,代码行数:11,代码来源:EmpreendimentoRepository.php

示例12: getTotalRows

 /**
  * {@inheritdoc}
  */
 public function getTotalRows(QueryBuilder $queryBuilder, ColumnCollection $columns)
 {
     $builder = clone $queryBuilder;
     $having = $builder->getDQLPart('having');
     if (is_object($having)) {
         $this->replaceHaving($having, $columns, $builder);
     }
     $query = $builder->getQuery();
     $paginator = new Paginator($query, true);
     $paginator->setUseOutputWalkers(false);
     return $paginator->count();
 }
开发者ID:Newman101,项目名称:WellCommerce,代码行数:15,代码来源:DataSetPaginator.php

示例13: getTotalRows

 /**
  * {@inheritdoc}
  */
 public function getTotalRows(QueryBuilder $queryBuilder, ColumnCollection $columns) : int
 {
     $builder = clone $queryBuilder;
     $having = $builder->getDQLPart('having');
     if (is_object($having)) {
         $this->replaceHaving($having, $columns, $builder);
     }
     $query = $builder->getQuery();
     $query->useQueryCache(true);
     $query->useResultCache(true, 3600, self::RESULT_CACHE_ID);
     $paginator = new Paginator($query, true);
     $paginator->setUseOutputWalkers(false);
     return $paginator->count();
 }
开发者ID:wellcommerce,项目名称:dataset,代码行数:17,代码来源:DataSetPaginator.php

示例14: listRecruits

 public function listRecruits($page = 1, $pageSize = 20)
 {
     $query = $this->em->createQuery('SELECT r, p FROM SSEICSSBundle:Recruit r LEFT JOIN r.suitableProjects p ORDER BY r.publishAt DESC');
     $paginator = new Paginator($query);
     $paginator->setUseOutputWalkers(false);
     $totalRecruits = count($paginator);
     $pagesCount = ceil($totalRecruits / $pageSize);
     $paginator->getQuery()->setFirstResult($pageSize * ($page - 1))->setMaxResults($pageSize);
     $list = $query->getArrayResult();
     foreach ($list as &$rec) {
         $rec['publishAt'] = $rec['publishAt']->format('Y-m-d');
     }
     return ["totalRecruits" => $totalRecruits, "currentPage" => $page, "pagesCount" => $pagesCount, "list" => $list];
 }
开发者ID:TJUSSE,项目名称:ICSS,代码行数:14,代码来源:RecruitService.php

示例15: paginate

 /**
  * paginate results
  *
  * @param $query - naming is a bit off as it can be a NativeQuery OR
  *  QueryBuilder, we'll survive eventually
  * @param int $page
  * @param $limit
  * @return array
  */
 public function paginate($query, $page, $limit, $userCount)
 {
     $totalPages = '';
     // setting current page
     $this->currentPage = $page;
     // set the limit
     $limit = (int) $limit;
     $this->count = $userCount;
     $this->totalPages = ceil($this->count / $limit);
     $newquery = $query->setFirstResult(($page - 1) * $limit)->setMaxResults($limit)->getQuery();
     $paginator = new DoctrinePaginator($newquery);
     $paginator->setUseOutputWalkers(false);
     // set total pages
     return $newquery->getResult();
 }
开发者ID:pavsuri,项目名称:PARMT,代码行数:24,代码来源:Paginator.php


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