/** * Saves the model and its relations. * @param ActiveRecord $model * @return bool * @throws \yii\base\InvalidConfigException */ protected function save($model) { /** @var \nineinchnick\audit\behaviors\TrackableBehavior $trackable */ if (($trackable = $model->getBehavior('trackable')) !== null) { $model->beginChangeset(); } $result = $model->save(false) && $model->saveRelations(Yii::$app->getRequest()->getBodyParams()); if ($trackable !== null) { $model->endChangeset(); } return $result; }