Exemple #1
0
 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]);
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDocument()
 {
     return $this->hasOne(Document::className(), ['id' => 'document_id']);
 }