Merge pull request #86 from apuc/add_document

update get-template-list method
This commit is contained in:
apuc authored and GitHub committed 2022-01-14 18:00:05 +03:00
commit 4cbb004c4d
6 files changed
+99 -4

No files matched your search

@@ -24,7 +24,14 @@ class TemplateController extends ApiController
public function actionGetTemplateList(): array
{
$template = Template::find()->asArray()->all();
$document_type = Yii::$app->request->get('document_type');
if (!empty($document_type)) {
$template = Template::find()->where(['document_type' => $document_type])->asArray()->all();
}
else {
$template = Template::find()->asArray()->all();
}
if (empty($template)) {
throw new NotFoundHttpException('Documents are not assigned');