本文整理汇总了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)');
}
示例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();
}
示例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;
}
示例4: hookOffset
/**
* set the hook offset
*
* @param integer $offset
*/
public function hookOffset($offset)
{
$this->query->offset((int) $offset);
}
示例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);
}
}
示例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)');
}
示例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);
}
}
示例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;
}