Example #1
0
 public function get_list(Criteria $criteria = null)
 {
     if (!$criteria) {
         $criteria = new Criteria();
     }
     if ($criteria->order()) {
         $this->db->order_by($criteria->order());
     }
     if ($criteria->limit()) {
         $this->db->limit($criteria->limit(), $criteria->offset());
     }
     $this->_prepare_fields($criteria);
     $this->_prepare_from();
     $this->_prepare_where($criteria);
     if ($this->_debug) {
         $res = $this->db->get();
         log_message('debug', $this->db->last_query());
         return $res->result_array();
     }
     $result = $this->db->get();
     if ($result === false) {
         throw new Exception($this->db->_error_message());
     }
     return $result->result_array();
 }