From d0fa6dd5126ae84b58a0f78bff61f2cf24e4878e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 3 Feb 2025 11:21:00 +0100 Subject: [PATCH] Apply fix to query idInsideBundle for documentCategory creation --- .../Controller/DocumentCategoryController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php index e67ac9751..061ce5330 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php @@ -92,13 +92,14 @@ class DocumentCategoryController extends AbstractController $nextId = $em ->createQuery( - 'SELECT MAX(c.idInsideBundle) + 1 FROM ChillDocStoreBundle:DocumentCategory c' + 'SELECT (CASE WHEN MAX(c.idInsideBundle) IS NULL THEN 1 ELSE MAX(c.idInsideBundle) + 1 END) + FROM ChillDocStoreBundle:DocumentCategory c' ) - ->getSingleResult(); + ->getSingleScalarResult(); $documentCategory = new DocumentCategory( ChillDocStoreBundle::class, - reset($nextId) + $nextId ); $documentCategory