['get'], 'get-document-list' => ['get'], // 'create-task' => ['post'], // 'update-task' => ['put', 'patch'], ]; } public function actionGetDocumentList(): array { $documents = Document::find()->select(['id','title', 'manager_id'])->all(); if(empty($documents)) { throw new NotFoundHttpException('Documents are not assigned'); } return $documents; } public function actionGetDocument(): array { $document_id = Yii::$app->request->get('document_id'); if(empty($document_id) or !is_numeric($document_id)) { throw new NotFoundHttpException('Incorrect document ID'); } $document = Document::find() ->joinWith(['documentFieldValues.field']) ->where(['document.id' => $document_id]) ->asArray() ->all(); if(empty($document)) { throw new NotFoundHttpException('There is no such document'); } return $document; } }