public function getAttachments() { return $this->hasMany(Attachment::className(), ['document_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getAttachments() { return $this->hasMany(Attachment::className(), ['document_id' => 'id'])->orderBy('priority'); }
public function actionDownload($id) { $model = $this->findModel(Attachment::className(), $id); $this->checkPermission($model); return $this->download($model->getPath()); }