public function where($where, $parse = null) { // echo substr($this->name, 0, -4);exit; if ($this->baseModelName) { $model = D($this->baseModelName); } else { $model = D(substr($this->name, 0, -4)); } // echo substr($this->name, 0, -4);exit; // print_r($model->fields); // var_dump($model->fields["_type"]["deleted"]); if (!isset($where["deleted"])) { if ($model->fields["_type"]["deleted"]) { $where["deleted"] = 0; } else { $tmp = $this->viewFields; foreach ($tmp as $k => $v) { $tmpModel = D($k); if ($tmpModel->fields["_type"]["deleted"]) { if (!is_array($where)) { $tmp = explode("=", $where); $where = array(); $where[$tmp[0]] = $tmp[1]; } $where[$k . ".deleted"] = 0; } break; } } } // print_r($where); return parent::where($where, $parse); }