/** * @inheritDoc */ public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub if (!$insert) { self::clearPermission($this->id); } }
/** * 重写更新记录,清除主键缓存 * * @param array $attributes * @param string $condition * @param array $params * @return int * @throws Exception */ public static function updateAll($attributes, $condition = [], $params = []) { $ret = parent::updateAll($attributes, $condition, $params); if ($ret && is_array($condition)) { if (self::allowFromCache($condition)) { $item = self::findOne([static::$pk => $condition[static::$pk]]); if ($item) { static::clearCache($item); } } } return $ret; }