Exemplo n.º 1
0
 public function init()
 {
     switch (1) {
         case !$this->revisionsModel instanceof RevisionsModel && ($this->parentType == null || $this->parentId == null):
             $this->_enableRevisions = false;
             break;
         default:
             $this->revisionsModel = $this->revisionsModel instanceof RevisionsModel ? $this->model : RevisionsModel::findModel([$this->parentId, $this->parentType]);
             break;
     }
     parent::init();
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRevisionModel()
 {
     return $this->getWidgetRelationModelQuery(\nitm\widgets\models\Revisions::className());
 }
 /**
  * Deletes an existing Revisions model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $user_id
  * @param string $remote_type
  * @param integer $remote_id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel(Revisions::className(), $id)->delete();
     return $this->redirect(['index']);
 }