$value, 'field in ? => new DbExpr('(1,2,3)')) * @return SqlCriteria */ public function where($conditions) { $this->where = $conditions; return $this; } /** * @param $fields array @ex array('field1', 'field2' => SqlModel::ORDER_DESC) * @return SqlCriteria */ public function order($fields) { if (!is_array($fields)) { $fields = array($fields); } $this->order = $fields; return $this; } /** * @param $limit int * @param $offset int * @return SqlCriteria */ public function limit($limit, $offset = 0) { if (empty($offset)) { $this->limit = (int) $limit; } $this->limit = (int)$limit . ',' . (int) $offset; return $this; } /** * @param mixed $select array @ex array('field1', 'field2', 'field3' => 'field') * @return string */ public function select($select) { if (!is_array($select)) { $select = array($select); } $this->select = $select; return $this; } /** * @param $field string * @return SqlCriteria */ public function distinct($field) { $this->distinct = $field; return $this; } }