本文整理汇总了PHP中Nette\Database\Table\Selection::limit方法的典型用法代码示例。如果您正苦于以下问题:PHP Selection::limit方法的具体用法?PHP Selection::limit怎么用?PHP Selection::limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Database\Table\Selection
的用法示例。
在下文中一共展示了Selection::limit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* @param int $limit
* @param int $offset
* @return array
*/
public function getData($limit = NULL, $offset = NULL)
{
if ($limit !== NULL) {
$this->source->limit($limit, $offset);
}
return $this->source->fetchAll();
}
示例2: appendLimit
static function appendLimit(Nette\Database\Table\Selection &$query, $limit = NULL, $offset = NULL)
{
if (!is_null($limit)) {
$query->limit($limit, $offset);
}
return $query;
}
示例3: render
/** Render funkcia pre vypisanie odkazu na clanok
* @see Nette\Application\Control#render()
*/
public function render()
{
if (count($this->dokumenty)) {
//Ak nieco mam, tak najdem nahodny
$obrazky = $this->dokumenty->limit(1, rand(0, count($this->dokumenty) - 1))->fetch();
$alt = $obrazky->popis;
$src = $obrazky->subor;
} else {
$alt = $this->texty["notFound"];
$src = "www/images/otaznik.png";
}
$this->template->setFile(__DIR__ . '/NahodnaFotka.latte');
$this->template->h4 = $this->texty["h4"];
$this->template->alt = $alt;
$this->template->src = $src;
$this->template->render();
}
示例4: reduce
/**
* Reduce the result starting from $start to have $count rows
*
* @param int the number of results to obtain
* @param int the offset
* @return IDataSource (fluent)
* @throws \OutOfRangeException
*/
public function reduce($count, $start = 0)
{
// Delibearately skipping check agains count($this)
if ($count === NULL) {
$count = 0;
}
if ($start === NULL) {
$start = 0;
}
if ($start < 0 || $count < 0) {
throw new \OutOfRangeException();
}
$this->selection->limit($count, $start);
return $this;
}
示例5: limit
/**
* @param int $offset
* @param int $limit
*/
public function limit($offset, $limit)
{
$this->selection->limit($limit, $offset);
}
示例6: limit
/**
* Apply limit and offset on data
* @param int $offset
* @param int $limit
* @return static
*/
public function limit($offset, $limit)
{
$this->data = $this->data_source->limit($limit, $offset)->fetchAll();
return $this;
}
示例7: limit
/**
* Sets limit clause.
* @param int $limit
* @param int $offset
* @return self
*/
public function limit($limit, $offset = null)
{
$this->selection->limit($limit, $offset);
return $this;
}
示例8: limit
/**
* Limit data
* @param int $limit
* @param int $offset
*/
public function limit($limit, $offset)
{
$this->table->limit($limit, $offset);
}
示例9: limit
/**
* @param int $limit
* @param int $offset
* @return EntityCollection
*/
public function limit($limit, $offset = NULL)
{
$this->selection->limit($limit, $offset);
$this->invalidate();
return $this;
}
示例10: addPaginator
/**
* @param Selection $out
* @param Paginator $paginator
* @return Selection
*/
protected function addPaginator($out, Paginator $paginator)
{
$paginator->setItemsPerPage($this->itemsPerPage);
$paginator->setItemCount($out->count());
$out->limit($paginator->itemsPerPage, $paginator->offset);
return $out;
}