本文整理汇总了PHP中Select::limit方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::limit方法的具体用法?PHP Select::limit怎么用?PHP Select::limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Select
的用法示例。
在下文中一共展示了Select::limit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectOne
public function selectOne(Select $select)
{
$select->limit(1)->offset(0);
$resultSet = $this->tableGateway->selectWith($select->getZendSelect());
$result = $resultSet->toArray();
return isset($result[0]) ? $result[0] : array();
}
示例2: limit
/**
* @example database::Query::limit
* @code
* <?php
* # cria objeto de consulta
* $query = Query::factory(...);
*
* # coluna que sera agrupada
* $query->limit(10, 0);
* ?>
* @endcode
*
* {@ineritdoc}
* */
public function limit($limit, $offset)
{
if (NULL == $this->_limit) {
$this->_limit = LimitAbstract::factory($this->_driver);
$this->_select->limit($this->_limit);
}
$this->_limit->set($limit, $offset);
return $this;
}
示例3: testLimit
public function testLimit()
{
$limit = 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(['limit'])->getMock();
$queryBuilder->expects($this->once())->method('limit')->with($this->equalTo($limit));
$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->limit($limit));
}
示例4: getAllOnWhere
protected static function getAllOnWhere($table_name, $class, $where = false, $values = false, $order = false, $ask = true, $count = false, $offset = false)
{
$select = new Select();
$select->from($table_name, "*");
if ($where) {
$select->where($where, $values);
}
if ($order) {
$select->order($order, $ask);
} else {
$select->order("id");
}
if ($count) {
$select->limit($count, $offset);
}
$data = self::$db->select($select);
return AbstractObjectDB::buildMultiple($class, $data);
}
示例5: 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);
}
}