Neos\Flow\Persistence\Generic\Query::setLimit PHP Method

setLimit() public method

Sets the maximum size of the result set to limit. Returns $this to allow for chaining (fluid interface)
public setLimit ( integer $limit ) : Neos\Flow\Persistence\QueryInterface
$limit integer
return Neos\Flow\Persistence\QueryInterface
    public function setLimit($limit)
    {
        if ($limit < 1 || !is_int($limit)) {
            throw new \InvalidArgumentException('setLimit() accepts only integers greater 0.', 1263387249);
        }
        $this->limit = $limit;
        return $this;
    }

Usage Example

コード例 #1
0
 /**
  * @test
  * @expectedException \InvalidArgumentException
  */
 public function setLimitRejectsIntegersLessThanOne()
 {
     $this->query->setLimit(0);
 }