Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LimitRenderer.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
23  public function render(Select $select, $sql = '')
24  {
25  $count = 0;
26  $offset = 0;
27  if (!empty($select->getPart(Select::LIMIT_OFFSET))) {
28  $offset = (int) $select->getPart(Select::LIMIT_OFFSET);
29  $count = PHP_INT_MAX;
30  }
31  if (!empty($select->getPart(Select::LIMIT_COUNT))) {
32  $count = (int) $select->getPart(Select::LIMIT_COUNT);
33  }
34  /*
35  * Add limits clause
36  */
37  if ($count > 0) {
38  $sql = new LimitExpression($sql, $count, $offset);
39  }
40  return $sql;
41  }
42 }
$count
Definition: recent.phtml:13
const LIMIT_OFFSET
Definition: Select.php:56
const LIMIT_COUNT
Definition: Select.php:55