From d4fff371ae873c2454ec7caa26fb542fc7455b8a Mon Sep 17 00:00:00 2001 From: Thibaud Date: Fri, 25 Oct 2024 15:06:38 +0200 Subject: [PATCH] fix UniqueConstraint namespace --- .../RestProblemBundle/EventListener/ExceptionListener.php | 3 ++- src/Alterway/Bundle/RestProblemBundle/Problem/Exception.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Alterway/Bundle/RestProblemBundle/EventListener/ExceptionListener.php b/src/Alterway/Bundle/RestProblemBundle/EventListener/ExceptionListener.php index cb8649a..242a828 100644 --- a/src/Alterway/Bundle/RestProblemBundle/EventListener/ExceptionListener.php +++ b/src/Alterway/Bundle/RestProblemBundle/EventListener/ExceptionListener.php @@ -4,6 +4,7 @@ use Alterway\Bundle\RestProblemBundle\Problem\Exception; use Alterway\Bundle\RestProblemBundle\Response\ProblemResponse; +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; @@ -33,7 +34,7 @@ public function onKernelException(ExceptionEvent $event) !$exception instanceof LogicException && !$exception instanceof HttpExceptionInterface && !$exception instanceof Assert\InvalidArgumentException && - !$exception instanceof Doctrine\DBAL\Exception\UniqueConstraintViolationException + !$exception instanceof UniqueConstraintViolationException ) { newrelic_notice_error($exception->getMessage(), $exception); newrelic_add_custom_parameter('file', $exception->getFile()); diff --git a/src/Alterway/Bundle/RestProblemBundle/Problem/Exception.php b/src/Alterway/Bundle/RestProblemBundle/Problem/Exception.php index fa1947b..04db31a 100644 --- a/src/Alterway/Bundle/RestProblemBundle/Problem/Exception.php +++ b/src/Alterway/Bundle/RestProblemBundle/Problem/Exception.php @@ -2,6 +2,7 @@ namespace Alterway\Bundle\RestProblemBundle\Problem; +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpFoundation\Response; @@ -19,7 +20,7 @@ public function __construct(\Throwable $exception, bool $isVerbose = false) case $exception instanceof HttpExceptionInterface; $this->httpStatus = $exception->getStatusCode(); break; - case $exception instanceof Doctrine\DBAL\Exception\UniqueConstraintViolationException; + case $exception instanceof UniqueConstraintViolationException; $this->httpStatus = Response::HTTP_CONFLICT; break; case $exception instanceof \LogicException: