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