diff --git a/application/symfony/src/Repository/Source/SourceRepository.php b/application/symfony/src/Repository/Source/SourceRepository.php index c6ae2a2..26e3f69 100644 --- a/application/symfony/src/Repository/Source/SourceRepository.php +++ b/application/symfony/src/Repository/Source/SourceRepository.php @@ -29,10 +29,10 @@ final class SourceRepository extends EntityRepository */ public function findOneByIdOrSlug(RequestedSourceInterface $requestedSource): ?SourceInterface { - try { + if ($requestedSource->hasId()) { return $this->find($requestedSource->getId()); - } catch (\Error $error) { - return $this->findOneBySlug($requestedSource->getSlug()); } + + return $this->findOneBySlug($requestedSource->getSlug()); } }