public function up() { foreach (\app\modules\review\models\Review::findAll(['root_id' => 0]) as $model) { $model->root_id = $model->id; $model->save(); } }
/** * @param array $returnUrl * @return Response * @throws \Exception */ public function actionRemoveAll($returnUrl = ['index']) { $items = Yii::$app->request->post('items', []); if (!empty($items)) { $items = Review::findAll(['id' => $items]); foreach ($items as $item) { $item->delete(); } Yii::$app->session->setFlash('info', Yii::t('app', 'Objects removed')); } return $this->redirect($returnUrl); }