Set or get the limit for the amount of results to return.
public limit ( integer | boolean $limit = null ) : integer | null | |
||
$limit | integer | boolean | An integer indicating the number of results to limit or `false` to employ no limit at all. Or `null` to retrieve the current limit. |
Результат | integer | null | |
Either the currrent limit when $limit is `null` or the query itself when setting the limit or providing `false`. |
public function testLimit() { $query = new Query($this->_queryArr); $expected = 10; $result = $query->limit(); $this->assertEqual($expected, $result); $query->limit(5); $expected = 5; $result = $query->limit(); $this->assertEqual($expected, $result); }