public function actionDeleteAttachment($id)
 {
     $attachment = Attachment::findOne($id);
     $document_id = $attachment->document_id;
     $attachment->delete();
     return $this->redirect(['update', 'id' => $document_id]);
 }
Exemplo n.º 2
0
 public function actionDelete($id)
 {
     \Yii::$app->response->format = Response::FORMAT_JSON;
     /* @var $model Attachment */
     if (Attachment::findOne($id)->delete()) {
         return ['success' => true];
     }
     return ['success' => false];
 }
Exemplo n.º 3
0
 public function loadAttachment($id)
 {
     if (($document = Attachment::findOne($id)) !== null) {
         return $document;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }