/** * Apply filters (internal) */ protected function _apply() { if ($this->_with_clear) { $this->collection->clear(1); } // prepend config // make shure no "limit sql" in it! $config = $this->config; // where sql prepare /* if (isset($config['where_sql'])) { $where_sql_ = $this->collection->cfg('where_sql'); if (!empty($where_sql_)) { $config['where_sql'] = $where_sql_ . ' AND ' . $config['where_sql']; } } */ // map filter config to collection if (!$config->is_empty()) { foreach ($config as $k => $v) { $this->collection->config->set($k, $v); } } // apply user filters $this->collection_filters(); $this->count = $this->_no_count ? $this->count : $this->collection->count_sql(); $this->_no_count = false; core::dprint('[FILTER] Apply for ' . $this->collection->get_name() . ' x ' . $this->count); }
/** * @param boolean load/or just return collection */ protected function _load($load = true) { $this->collection->clear(); if ($this->_where) { $this->collection->set_where($this->_where); } if ($this->_order) { $this->collection->set_order($this->_order); } return $load ? $this->collection->load() : $this->collection; }