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


PHP Doctrine_Query::offset方法代碼示例

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


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

示例1: testQuerySetOffsetToZero

 public function testQuerySetOffsetToZero()
 {
     $q = new Doctrine_Query();
     $q->from('User u');
     $q->offset(20);
     $q->offset(0);
     $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id FROM entity e WHERE (e.type = 0)');
 }
開發者ID:dennybrandes,項目名稱:doctrine1,代碼行數:8,代碼來源:RemoveQueryPartTestCase.php

示例2: getItems

 /**
  * Get items
  *
  * @param int $offset
  * @param int $itemsPerPage
  * @return Doctrine_Collection
  */
 public function getItems($offset, $itemsPerPage)
 {
     if ($itemsPerPage !== null) {
         $this->_query->limit($itemsPerPage);
     }
     if ($offset !== null) {
         $this->_query->offset($offset);
     }
     return $this->_query->execute();
 }
開發者ID:lciolecki,項目名稱:zf-doctrine,代碼行數:17,代碼來源:DoctrineQuery.php

示例3: getItems

 /**
  * Implementation of method from Zend_Paginator_Adapter_Interface.
  *
  * @param integer $offset
  * @param integer $itemsPerPage
  * @return array[numeric|whatever]=>array|Doctrine_Record
  */
 public function getItems($offset, $itemsPerPage)
 {
     $this->_query->limit($itemsPerPage);
     $this->_query->offset($offset);
     $result = $this->_query->execute(array(), $this->_hydrationMode);
     return $result;
 }
開發者ID:Neozeratul,項目名稱:Intermodels,代碼行數:14,代碼來源:Adapter.php

示例4: hookOffset

 /**
  * set the hook offset
  *
  * @param integer $offset
  */
 public function hookOffset($offset)
 {
     $this->query->offset((int) $offset);
 }
開發者ID:darkcolonist,項目名稱:kohana234-doctrine115,代碼行數:9,代碼來源:Hook.php

示例5: modifyImpl

 /**
  * Typesafe call to modify
  * @access private
  **/
 protected function modifyImpl(Doctrine_Query &$o)
 {
     $o->offset($this->offset);
     if ($this->limit > 0) {
         $o->limit($this->limit);
     }
 }
開發者ID:philippjenni,項目名稱:icinga-web,代碼行數:11,代碼來源:StorePaginationModifierModel.class.php

示例6: testLimitWithOneToManyInnerJoin

 public function testLimitWithOneToManyInnerJoin()
 {
     $q = new Doctrine_Query();
     $q->select('u.id, p.*')->from('User u INNER JOIN u.Phonenumber p');
     $q->limit(5);
     $sql = $q->getQuery();
     $users = $q->execute();
     $count = $this->conn->count();
     $this->assertEqual($users->count(), 5);
     $users[0]->Phonenumber[0];
     $this->assertEqual($count, $this->conn->count());
     $q->offset(2);
     $users = $q->execute();
     $count = $this->conn->count();
     $this->assertEqual($users->count(), 5);
     $users[3]->Phonenumber[0];
     $this->assertEqual($count, $this->conn->count());
     $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, p.id AS p__id, p.phonenumber AS p__phonenumber, p.entity_id AS p__entity_id FROM entity e INNER JOIN phonenumber p ON e.id = p.entity_id WHERE e.id IN (SELECT DISTINCT e2.id FROM entity e2 INNER JOIN phonenumber p2 ON e2.id = p2.entity_id WHERE (e2.type = 0) LIMIT 5 OFFSET 2) AND (e.type = 0)');
 }
開發者ID:ninjapenguin,項目名稱:kohana-Doctrine-module,代碼行數:19,代碼來源:LimitTestCase.php

示例7: rec_query_page

 /**
  * Add a limit/offset to a Doctrine_Query.
  *
  * @param Doctrine_Query $q
  * @param int   $limit
  * @param int   $offset
  */
 protected function rec_query_page(Doctrine_Query $q, $limit, $offset)
 {
     if ($limit > 0) {
         $q->limit($limit);
     }
     if ($offset > 0) {
         $q->offset($offset);
     }
 }
開發者ID:kaakshay,項目名稱:audience-insight-repository,代碼行數:16,代碼來源:DOCframe_Resource.php

示例8: setPagingFromOptions

 static function setPagingFromOptions(Doctrine_Query $q, array $options, $defaultNum = null, $maxNum = null)
 {
     $num = @$options['num'] ? $options['num'] : $defaultNum;
     if ($num && $maxNum) {
         $num = $num > $maxNum ? $maxNum : $num;
     }
     if ($num) {
         $q->limit($num);
         if ($page = @$options['page']) {
             $q->offset($num * ($page - 1));
         }
     }
     return $q;
 }
開發者ID:silky,項目名稱:littlesis,代碼行數:14,代碼來源:LsApi.class.php


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