public function limit($limit, $offset = null)
    {
        if ($offset !== null) {
            $this->builder->setFirstResult((int) $offset);
        }

        $this->builder->setMaxResults((int) $limit);

        return $this;
    }
public function limit($limit, $offset = null)
    {
        if ($offset !== null) {
            $this->builder->setFirstResult((int) $offset);
        }

        $this->builder->setMaxResults((int) $limit);

        return $this;
    }
public function limit ( $ limit , $ offset = null ) { if ( $ offset !== null ) { $ this -> builder -> setFirstResult ( ( int ) $ offset ) ; } $ this -> builder -> setMaxResults ( ( int ) $ limit ) ; return $ this ; }
Sets limits to query

@param int      $limit
@param null|int $offset

@return $this
Sets limits to query