From c50dc189a775dd280dcc3573dc9f6902bd5818ab Mon Sep 17 00:00:00 2001 From: Kavalar Date: Wed, 17 May 2023 14:43:27 +0300 Subject: [PATCH] add entity_type to comment getter --- .../modules/api/controllers/CommentController.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/modules/api/controllers/CommentController.php b/frontend/modules/api/controllers/CommentController.php index 015f870..797755e 100644 --- a/frontend/modules/api/controllers/CommentController.php +++ b/frontend/modules/api/controllers/CommentController.php @@ -227,6 +227,16 @@ class CommentController extends ApiController * ) * ), * + * @OA\Parameter( + * name="entity_type", + * in="query", + * required=true, + * @OA\Schema( + * type="integer", + * default=null + * ) + * ), + * * @OA\Response( * response=200, * description="Возвращает массив объектов Комментариев", @@ -240,9 +250,9 @@ class CommentController extends ApiController * @param int $entity_id * @return array|\yii\db\ActiveRecord[] */ - public function actionGetByEntity(int $entity_id): array + public function actionGetByEntity(int $entity_id, int $entity_type): array { - $model = Comment::find()->where(['entity_id' => $entity_id, 'status' => Comment::STATUS_ACTIVE])->all(); + $model = Comment::find()->where(['entity_id' => $entity_id, 'entity_type' => $entity_type, 'status' => Comment::STATUS_ACTIVE])->all(); return $model; }