From 2fd38df59b68c69a5c880bda4ef72c08958d3ad1 Mon Sep 17 00:00:00 2001 From: Kavalar Date: Fri, 6 Oct 2023 00:50:54 +0300 Subject: [PATCH] fix mark attach --- frontend/modules/api/controllers/MarkController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/modules/api/controllers/MarkController.php b/frontend/modules/api/controllers/MarkController.php index 639783a..a91cc62 100644 --- a/frontend/modules/api/controllers/MarkController.php +++ b/frontend/modules/api/controllers/MarkController.php @@ -228,6 +228,11 @@ class MarkController extends ApiController throw new NotFoundHttpException('Mark not found'); } + $markEntity = MarkEntity::findOne(['mark_id' => $request['mark_id'], 'entity_type' => $request['entity_type'], 'entity_id' => $request['entity_id']]); + if ($markEntity) { + throw new ServerErrorHttpException('Mark is already attached'); + } + $markEntity = new MarkEntity(); $markEntity->load($request, '');