Exemple #1
0
 /**
  * Return SQL condition with limits
  *
  * @param integer                $start Index of the first item on the page OPTIONAL
  * @param integer                $count Number of items per page OPTIONAL
  * @param \XLite\Core\CommonCell $cnd   Search condition OPTIONAL
  *
  * @return array|\Doctrine\ORM\PersistentCollection
  */
 public function getLimitCondition($start = null, $count = null, \XLite\Core\CommonCell $cnd = null)
 {
     if (!isset($start)) {
         $start = $this->getStartItem();
     }
     if (!isset($count)) {
         $count = $this->getItemsPerPage();
     }
     if ($this->getMaxItemsCount()) {
         $count = max(0, min($count, $this->getMaxItemsCount() - $start));
     }
     return \XLite\Model\Repo\Base\Searchable::addLimitCondition($start, $count, $cnd);
 }
Exemple #2
0
 /**
  * Return list of items to display on the current page
  *
  * @param integer $start Index of the first item on the page
  * @param integer $count Number of items per page
  *
  * @return array|\Doctrine\ORM\PersistentCollection
  */
 protected function getDataFrame($start, $count)
 {
     return $this->getCategory()->getProducts(\XLite\Model\Repo\Base\Searchable::addLimitCondition($start, $count));
 }