Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\ORM\OptimisticLockException;
use GraphQL\GraphQL;
Expand Down Expand Up @@ -594,6 +595,7 @@ private function addExceptionToStatusSection(ArrayNodeDefinition $rootNode): voi
InvalidArgumentException::class => Response::HTTP_BAD_REQUEST,
OptimisticLockException::class => Response::HTTP_CONFLICT,
UniqueConstraintViolationException::class => Response::HTTP_UNPROCESSABLE_ENTITY,
ForeignKeyConstraintViolationException::class => Response::HTTP_CONFLICT,
])
->info('The list of exceptions mapped to their HTTP status code.')
->normalizeKeys(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use ApiPlatform\Metadata\Exception\InvalidArgumentException;
use ApiPlatform\Symfony\Bundle\DependencyInjection\Configuration;
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\ORM\OptimisticLockException;
use PHPUnit\Framework\Attributes\DataProvider;
Expand Down Expand Up @@ -103,6 +104,7 @@ private function runDefaultConfigTests(array $doctrineIntegrationsToLoad = ['orm
InvalidArgumentException::class => Response::HTTP_BAD_REQUEST,
OptimisticLockException::class => Response::HTTP_CONFLICT,
UniqueConstraintViolationException::class => Response::HTTP_UNPROCESSABLE_ENTITY,
ForeignKeyConstraintViolationException::class => Response::HTTP_CONFLICT,
],
'path_segment_name_generator' => 'api_platform.metadata.path_segment_name_generator.underscore',
'inflector' => 'api_platform.metadata.inflector',
Expand Down
Loading