/** * @test * @expectedException \InvalidArgumentException */ public function setLimitRejectsIntegersLessThanOne() { $this->query->setLimit(0); }
/** * Sets a limit on an extbase query by given query object. Returns manipulated extbase query. * * @param Tx_PtExtlist_Domain_QueryObject_Query $query * @param \TYPO3\CMS\Extbase\Persistence\Generic\Query $extbaseQuery * @return \TYPO3\CMS\Extbase\Persistence\Generic\Query */ public static function setLimitOnExtBaseQueryByQueryObject(Tx_PtExtlist_Domain_QueryObject_Query $query, \TYPO3\CMS\Extbase\Persistence\Generic\Query $extbaseQuery) { if ($query->getLimit() != '') { list($offset, $limit) = explode(':', $query->getLimit()); if (!$limit > 0) { $extbaseQuery->setLimit(intval($offset)); // no offset set, so offset = limit } else { $extbaseQuery->setOffset(intval($offset)); $extbaseQuery->setLimit(intval($limit)); } } return $extbaseQuery; }
/** * Sets the maximum size of the result set to limit. Returns $this to allow * for chaining (fluid interface) * * @param integer $limit * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface */ public function setLimit($limit) { parent::setLimit($limit); if ($this->statement) { $this->sqlParser->setLimitStatement($this->getLimitStatement()); $statement = $this->sqlParser->toString(); $this->statement = $this->qomFactory->statement($statement, $this->parameters); } return $this; }