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 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