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