Merge branch '354-fix_creation_document_category' into 'master'

Resolve "chill_doc: cannot create a document category"

Closes #354

See merge request Chill-Projet/chill-bundles!791
This commit is contained in:
Julien Fastré 2025-02-03 21:02:03 +00:00
commit cc150e32f0
2 changed files with 10 additions and 3 deletions

View File

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

View File

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