/** * Поиск модели * * @param $id * @return array|null|\yii\db\ActiveRecord * @throws NotFoundHttpException */ protected function findModel($id) { $model = Book::findById($id); if (!$model) { throw new NotFoundHttpException(); } return $model; }