Пример #1
0
 /**
  * @return int
  */
 public function count()
 {
     if (null === $this->totalItemCount) {
         $this->totalItemCount = $this->data->count();
     }
     return $this->totalItemCount;
 }
Пример #2
0
 /**
  * @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);
 }