addBehavior( new SoftDelete([ 'field' => 'deleted', 'value' => 1, ]) ); } public function beforeCreate() { $this->create_time = time(); } public function beforeUpdate() { if ($this->deleted == 1) { $this->published = 0; } $this->update_time = time(); } public function afterCreate() { $cache = new MaxPackageIdCache(); $cache->rebuild(); } public function afterFetch() { $this->market_price = (float)$this->market_price; $this->vip_price = (float)$this->vip_price; } }