Skip to content

Session: add Patch operation to /api/sessions/{id}#8673

Open
addow wants to merge 1 commit into
chamilo:masterfrom
webstone:feat/session-patch-operation
Open

Session: add Patch operation to /api/sessions/{id}#8673
addow wants to merge 1 commit into
chamilo:masterfrom
webstone:feat/session-patch-operation

Conversation

@addow

@addow addow commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • Adds PATCH /api/sessions/{id} alongside the existing PUT, restricted to ROLE_ADMIN
  • Fixes a false 422 "title already used" on PUT: API Platform 3 can create a new entity object during PUT denormalization (id=null), causing UniqueEntity to flag the existing title as a conflict with itself
  • PATCH correctly preserves object_to_populate and avoids this issue
  • Enables partial updates without resending the full resource

Test plan

  • PATCH /api/sessions/{id} with unchanged title → HTTP 200
  • PATCH /api/sessions/{id} with changed title → HTTP 200
  • PATCH /api/sessions/{id} with title already used by another session → HTTP 422
  • PUT /api/sessions/{id} still works

Adds PATCH alongside the existing PUT so callers can do partial updates
without resending the full resource. Fixes a UniqueEntity false-422 that
occurs on PUT when AP3 creates a new entity object during denormalization
(id=null), causing the validator to flag the existing title as a conflict.
PATCH correctly preserves object_to_populate and avoids the issue.
@addow addow force-pushed the feat/session-patch-operation branch from fd6d435 to 920d151 Compare June 30, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant