Merge pull request #86 from apuc/add_document

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

View File

@ -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');