addBehavior( new SoftDelete([ 'field' => 'deleted', 'value' => 1, ]) ); } public function beforeCreate() { $this->create_time = time(); } public function beforeUpdate() { $this->update_time = time(); } public function afterCreate() { $maxUserIdCache = new MaxUserIdCache(); $maxUserIdCache->rebuild(); } public static function genderTypes() { return [ self::GENDER_MALE => '男', self::GENDER_FEMALE => '女', self::GENDER_NONE => '保密', ]; } public static function eduRoleTypes() { return [ self::EDU_ROLE_STUDENT => '学员', self::EDU_ROLE_TEACHER => '讲师', ]; } }