Session: add Patch operation to /api/sessions/{id}#8673
Conversation
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.
fd6d435 to
920d151
Compare
|
Adding PATCH is the right direction for the future AP4/Symfony7 upgrade (PATCH keeps stable merge semantics; PUT will switch to unconditional replace). A few points before merge: 1. The stated root cause doesn't hold with our current config. The false 422 you describe (PUT denormalizing into a fresh object with 2. No caller uses PATCH yet. The session service is 3. Regression test. Since the reproduction is unclear, a PHPUnit API test ( Security ( |
Summary
PATCH /api/sessions/{id}alongside the existingPUT, restricted toROLE_ADMINPUT: API Platform 3 can create a new entity object during PUT denormalization (id=null), causingUniqueEntityto flag the existing title as a conflict with itselfPATCHcorrectly preservesobject_to_populateand avoids this issueTest plan