public function afterSave($event) { $attributes = Yii::$app->request->post('MetaTag', Yii::$app->request->get('MetaTag', null)); if ($attributes) { $model = $this->getModel(); if (!isset($model)) { $model = new MetaTag(); } $attributes['model_id'] = $this->owner->id; $attributes['model'] = (new \ReflectionClass($this->owner))->getShortName(); $model->attributes = $attributes; $model->save(); } }