本文整理汇总了PHP中Select::offset方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::offset方法的具体用法?PHP Select::offset怎么用?PHP Select::offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Select
的用法示例。
在下文中一共展示了Select::offset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOffset
public function testOffset()
{
$offset = 123;
$table = $this->getMockBuilder(\Sharkodlak\FluentDb\Table::class)->disableOriginalConstructor()->getMock();
$factory = $this->getMockBuilder(\Sharkodlak\FluentDb\Factory\Factory::class)->getMock();
$queryBuilder = $this->getMockBuilder(\Sharkodlak\FluentDb\Query\Builder::class)->setConstructorArgs(['SELECT', 'FROM'])->setMethods(['offset'])->getMock();
$queryBuilder->expects($this->once())->method('offset')->with($this->equalTo($offset));
$factory->expects($this->once())->method('getQueryBuilder')->will($this->returnValue($queryBuilder));
$table->expects($this->once())->method('getFactory')->will($this->returnValue($factory));
$query = new Select($table);
$this->assertInstanceOf(Select::class, $query->offset($offset));
}
示例2: setLimits
/**
* Add limits so we retrieve only relavant rows
*
* @param Select $select Original select
*
* @return void
*/
protected function setLimits($select)
{
if ($this->_show !== 0) {
$select->limit($this->_show);
$select->offset(($this->current_page - 1) * $this->_show);
}
}