Skip to content

Fix back-office category save payload normalization#258

Open
CySSoO wants to merge 1 commit intomasterfrom
cyssoo/task-title
Open

Fix back-office category save payload normalization#258
CySSoO wants to merge 1 commit intomasterfrom
cyssoo/task-title

Conversation

@CySSoO
Copy link
Copy Markdown
Contributor

@CySSoO CySSoO commented Apr 20, 2026

Motivation

  • Categories could fail to save from the back office because the controller form sometimes posts a nested category[...] payload while the assembler expected a flat array.
  • An empty string for id_parent_category could be persisted as '' which may cause issues with DB constraints or relation checks.

Description

  • Added an extractPayload helper to CategoryCommandAssembler and call it from assembleCreate and assembleUpdate to accept both nested category[...] payloads and flat arrays.
  • Coerce an empty id_parent_category string to null in mergeDefaults so parent IDs are either integers or null.
  • Keep existing default merging behavior and apply the normalization for both create and update command assembly.

Testing

  • Ran php -l src/Application/Blog/CategoryCommandAssembler.php which reported no syntax errors (success).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant