public function safeDown()
 {
     // drop tables in reverse order (for foreign key constraints)
     $this->dropTable(Profile::tableName());
     $this->dropTable(UserKey::tableName());
     $this->dropTable(User::tableName());
     $this->dropTable(Role::tableName());
 }
Пример #2
0
 /**
  * Delete an existing User model. If deletion is successful, the browser
  * will be redirected to the 'index' page.
  *
  * @param string $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     // delete profile and userkeys first to handle foreign key constraint
     $user = $this->findModel($id);
     $profile = $user->profile;
     UserKey::deleteAll(['user_id' => $user->id]);
     UserAuth::deleteAll(['user_id' => $user->id]);
     $profile->delete();
     $user->delete();
     return $this->redirect(['index']);
 }
Пример #3
0
 /**
  * @inheritdoc
  */
 public function upManual()
 {
     // delete neo user that the migration automatically adds
     UserKey::deleteAll(['user_id' => 1]);
     UserAuth::deleteAll(['user_id' => 1]);
     Profile::deleteAll(['user_id' => 1]);
     User::deleteAll(['id' => 1]);
 }
Пример #4
0
 /**
  * Delete an existing User model. If deletion is successful, the browser
  * will be redirected to the 'index' page.
  *
  * @param string $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     // delete profile and userkeys first to handle foreign key constraint
     $user = $this->findModel($id);
     $profile = $user->profile;
     $userabonnement = $user->abonnement;
     $company = Yii::$app->getModule("user")->model("Company");
     $company = $company::findOne(['user_id' => $id]);
     $tariefDag = Yii::$app->getModule("user")->model("UserTarievenDag");
     $tariefDag = $tariefDag::findOne(['user_id' => $id]);
     $tariefNacht = Yii::$app->getModule("user")->model("UserTarievenNacht");
     $tariefNacht = $tariefNacht::findOne(['user_id' => $id]);
     $tariefWeekend = Yii::$app->getModule("user")->model("UserTarievenWeekend");
     $tariefWeekend = $tariefWeekend::findOne(['user_id' => $id]);
     $reistarief = Yii::$app->getModule("user")->model("UserReistarief");
     $reistarief = $reistarief::findOne(['user_id' => $id]);
     $invoice = Yii::$app->getModule("user")->model("UserInvoice");
     $invoice = $invoice::findOne(['user_id' => $id]);
     $activedays = Yii::$app->getModule("user")->model("UserActivedays");
     $activedays = $activedays::findOne(['user_id' => $id]);
     UserKey::deleteAll(['user_id' => $user->id]);
     UserAuth::deleteAll(['user_id' => $user->id]);
     if (isset($profile)) {
         $profile->delete();
     }
     if (isset($userabonnement)) {
         $userabonnement->delete();
     }
     if (isset($tariefDag)) {
         $tariefDag->delete();
     }
     if (isset($tariefNacht)) {
         $tariefNacht->delete();
     }
     if (isset($tariefWeekend)) {
         $tariefWeekend->delete();
     }
     if (isset($reistarief)) {
         $reistarief->delete();
     }
     $this->deleteZoHoContact($user);
     if (isset($invoice)) {
         $invoice->delete();
     }
     if (isset($activedays)) {
         $activedays->delete();
     }
     $this->deleteDependentUsers($user);
     $user->delete();
     return $this->redirect(['index']);
 }