addBehavior( new SoftDelete([ 'field' => 'deleted', 'value' => 1, ]) ); } public function beforeCreate() { $this->create_time = time(); if (!empty($this->item_info)) { $this->item_info = kg_json_encode($this->item_info); } else { $this->item_info = ''; } } public function beforeUpdate() { $this->update_time = time(); } public function afterFetch() { if (!empty($this->item_info)) { $this->item_info = json_decode($this->item_info, true); } } }