예제 #1
0
 /**
  * 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;
 }
예제 #2
-1
 /**
  * @param \netis\crud\db\ActiveRecord $model
  * @param null|yii\db\Transaction $transaction
  */
 protected function afterExecute($model, $transaction)
 {
     if ($model->getBehavior('trackable') !== null) {
         $model->endChangeset();
     }
     if ($transaction !== null) {
         $transaction->commit();
     }
 }