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


PHP QueryBuilder::getFirstResult方法代碼示例

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


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

示例1: testCreateDataSet_pagination

 public function testCreateDataSet_pagination()
 {
     $request = $this->getBaseRequest();
     $request->displayStart = 100;
     $request->displayLength = 10;
     $dataSet = $this->dataSource->createDataSet($request);
     $this->assertEquals(100, $this->qb->getFirstResult());
     $this->assertEquals(10, $this->qb->getMaxResults());
 }
開發者ID:deft,項目名稱:datatables-php,代碼行數:9,代碼來源:QueryBuilderDataSourceTest.php

示例2: getData

 /**
  * It is possible to use query builder with additional columns.
  * In this case, only item at index [0] is returned, because
  * it should be an entity object.
  * @return array
  */
 public function getData()
 {
     $data = array();
     // Paginator is better if the query uses ManyToMany associations
     $result = $this->qb->getMaxResults() !== NULL || $this->qb->getFirstResult() !== NULL ? new Paginator($this->getQuery()) : $this->qb->getQuery()->getResult();
     foreach ($result as $item) {
         // Return only entity itself
         $data[] = is_array($item) ? $item[0] : $item;
     }
     return $data;
 }
開發者ID:s4muel,項目名稱:grido,代碼行數:17,代碼來源:Doctrine.php

示例3: getData

 /**
  * It is possible to use query builder with additional columns.
  * In this case, only item at index [0] is returned, because
  * it should be an entity object.
  * @return array
  */
 public function getData()
 {
     // Paginator is better if the query uses ManyToMany associations
     $usePaginator = $this->qb->getMaxResults() !== NULL || $this->qb->getFirstResult() !== NULL;
     $data = array();
     if ($usePaginator) {
         $paginator = new Paginator($this->getQuery());
         // Convert paginator to the array
         foreach ($paginator as $result) {
             // Return only entity itself
             $data[] = is_array($result) ? $result[0] : $result;
         }
     } else {
         foreach ($this->qb->getQuery()->getResult() as $result) {
             // Return only entity itself
             $data[] = is_array($result) ? $result[0] : $result;
         }
     }
     return $data;
 }
開發者ID:cujan,項目名稱:vcelyweb,代碼行數:26,代碼來源:Doctrine.php

示例4: getFirstResult

 /**
  * {@inheritdoc}
  */
 public function getFirstResult()
 {
     return $this->queryBuilder->getFirstResult();
 }
開發者ID:paolotremadio,項目名稱:SonataDoctrineORMAdminBundle,代碼行數:7,代碼來源:ProxyQuery.php

示例5: getCount

 /**
  * @param type $select string podawany do $qb->select np $qb->select('count(*)'[, ...])
  *                     Nalezy podać tylko jeden parametr!!!!!!!!!!!!!!!!
  */
 public function getCount()
 {
     $offset = $this->qb->getFirstResult();
     $this->qb->setFirstResult(null);
     $tmp = call_user_func_array(array($this->qb, 'select'), func_get_args());
     $return = $tmp->getQuery()->getSingleScalarResult();
     $this->qb->setFirstResult($offset);
     return $return;
 }
開發者ID:stopsopa,項目名稱:utils,代碼行數:13,代碼來源:KendoQbParser.php


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