예제 #1
0
 public function redeploy(Deploy $model, $data)
 {
     Event::on(Deploy::className(), Deploy::EVENT_AFTER_INSERT, function ($event) use($model) {
         $model->status = Deploy::REDEPLOY_SUCCESS;
         $model->update(false);
     });
     Event::on(DeployForm::className(), DeployForm::EVENT_AFTER_VALIDATE, function ($event) use($model) {
         $event->sender->tasks_id = array_unique(array_merge($event->sender->tasks_id, ArrayHelper::getColumn($model->deployHasTask, 'tasks_id', [])));
     });
     return $this->deploy($model->websites_id, $data);
 }
예제 #2
0
 public function safeDown()
 {
     $this->dropTable('IF EXISTS ' . Websites::tableName());
     $this->dropTable('IF EXISTS ' . Tasks::tableName());
     $this->dropTable('IF EXISTS ' . Deploy::tableName());
     $this->dropTable('IF EXISTS ' . DeployHasTasks::tableName());
     $this->dropTable('IF EXISTS ' . WebsiteHasUser::tableName());
     return true;
 }
예제 #3
0
 public function actionRedeploy($id)
 {
     $model = Deploy::find()->getById($id);
     WebsiteService::checkAccess($model->websites_id);
     $tasks = Tasks::find()->byWebsite($model->websites_id)->isPass()->all();
     $service = new DeployService();
     $form = $service->redeploy($model, \Yii::$app->request->post('DeployForm'));
     return $this->render('deploy', ['model' => $form, 'tasks' => $tasks]);
 }
예제 #4
0
 /**
  * @inheritDoc
  */
 public function __construct($config = [])
 {
     $this->_model = new Deploy();
     parent::__construct(array_merge($this->_model->attributes(), ['tasks_id']), $config);
 }