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