Пример #1
0
 public function actionRegion2($id = null)
 {
     //Удаляет лишние регионы
     $ru = RegionUrL::find()->all();
     foreach ($ru as $ru2) {
         $ur = null;
         //print_r($ru2);
         $ur = Ur::find()->where(['id' => $ru2['id_ur']])->all();
         if (!$ur) {
             //   $model = RegionUrL::findOne($ru2['id']);
             //  $model->delete();
             print $ru2['id_ur'];
             print "<br>";
         }
     }
 }
Пример #2
0
 /**
  * Deletes an existing Ur model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     //  Apteki::deleteAll(['ur_l_id' => $id]); // Не логируется
     //Удаляем аптеки
     $aprdel = Apteki::find()->where(['ur_l_id' => $id])->all();
     foreach ($aprdel as $apt) {
         $customer = Apteki::findOne($apt['id']);
         $customer->delete();
     }
     //Удаляем регоны
     $regiondel = RegionUrL::find()->where(['id_ur' => $id])->all();
     foreach ($regiondel as $reg) {
         $customer2 = RegionUrL::findOne($reg['id']);
         $customer2->delete();
     }
     return $this->redirect(['/']);
 }