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