From d0fa6dd5126ae84b58a0f78bff61f2cf24e4878e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 3 Feb 2025 11:21:00 +0100 Subject: [PATCH 1/2] 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 From 26cf6459b4d644069536fc5eba0059b6ff074406 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 3 Feb 2025 11:23:12 +0100 Subject: [PATCH 2/2] Add changie --- .changes/unreleased/Fixed-20250203-112259.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixed-20250203-112259.yaml diff --git a/.changes/unreleased/Fixed-20250203-112259.yaml b/.changes/unreleased/Fixed-20250203-112259.yaml new file mode 100644 index 000000000..ca70043a7 --- /dev/null +++ b/.changes/unreleased/Fixed-20250203-112259.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Fix document category creation +time: 2025-02-03T11:22:59.977168975+01:00 +custom: + Issue: "354" + SchemaChange: No schema change