/** * @return array */ public function items() { if (null === $this->itemArray) { $this->itemArray = $this->data->limit($this->limit, ($this->page - 1) * $this->limit)->all(); } return $this->itemArray; }
/** * @param \Kendo\Db\SqlSelect $select * @param array $query * @param string $type * * @return bool */ public function applyOptionsToSelect(&$select, $query, $type = null) { $needToFilterType = true; if (!empty($query['mode'])) { $mode = $query['mode']; if ($mode == 'new') { if (!empty($query['maxId'])) { $select->where('f.feed_id > ?', $query['maxId']); } } else { if ($mode == 'more') { if (!empty($query['minId'])) { $select->where('f.feed_id < ?', $query['minId']); } } else { if (!empty($query['feedId'])) { /** * Select feed if does not require other kinds. */ $needToFilterType = false; if (is_array($query['feedId'])) { $select->where('f.feed_id IN ?', $query['feedId']); } else { $select->where('f.feed_id = ?', $query['feedId']); } } } } } if ($needToFilterType && $type) { $feedTypes = $this->getFeedTypeShowOnTarget($type); if (!empty($feedTypes)) { $select->where('f.feed_type IN ?', $feedTypes); } } $limit = !empty($query['limit']) ? intval($query['limit']) : 0; $select->limit($limit < 1 ? self::DEFAULT_LIMIT_FEED : $limit, 0); }