Conversation
This was referenced Sep 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
exception_to_statusdefaults)exception_to_statusgainedUniqueConstraintViolationException => 422in #8478. Its sibling —ForeignKeyConstraintViolationException— is still unmapped, so a referential integrity violation surfaces as a 500 carrying the raw driver message.Measured on 5.0.0 / MySQL 8, deleting a row that is still referenced:
Two things are wrong there. The status: the request conflicts with the current state of the resource, it is not a server fault. And the payload, which hands the client the schema, the table, the column and the constraint name —
Error::createFromException()puts$exception->getMessage()straight intodetail, with nokernel.debugguard on that path, so it is not a debug-only leak.409 also matches what
OptimisticLockExceptionalready maps to: both say "the current state of the resource refuses this".Open question for reviewers
ForeignKeyConstraintViolationExceptioncovers two situations:exception_to_statusmaps a class to a single status, so this PR picks 409 for both, on the grounds that either way the request conflicts with the current state of the graph. Happy to switch to 422 if you would rather align with the unique-constraint precedent.Test plan
tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.phpextended with the new default, exactly as feat(symfony): map UniqueConstraintViolationException to 422 by default #8478 did.vendor/bin/phpunit tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php→OK (25 tests, 52 assertions).Configuration.phpside alone turns that suite red (2 failures), so the assertion covers the default rather than passing by accident.