/** * Экшен для сохранения новости */ protected function actionSave() { $article = \App\Models\Article::giveOne($_POST['id']); if (false === $article) { throw new \App\Exceptions\ObjectNotFound('Запрашиваемый объект не найден'); } $article->fill($_POST); $article->author = \App\Models\Author::giveOne($_POST['author_id']); try { $article->save(); $this->redirect('/admin'); } catch (\App\MultiException $ex) { $this->view->article = $article; $this->view->authors = \App\Models\Author::findAll(); $this->view->errors = $ex; $this->view->display(__DIR__ . '/../../templates/admin/news/tmp_edit.php'); } }