public function actionView($id) { /** * @var Document $model */ $model = Document::findOne(['id' => $id]); if (null === $model) { throw new HttpException(404); } $attachments = $model->getAttachments()->all(); return $this->render("view", ["model" => $model, "attachments" => $attachments]); }