Answer the question
In order to leave comments, you need to log in
How to catch an exception in symphony when {id} is not found in the route?
tell me how to catch an exception in symphony when {id} is not found in the route?
[2021-12-20 17:27:12] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "App\Entity\User object not found by the @ParamConverter annotation."
/**
* @Route("/{id}", name="user", requirements={"id"="\d+"})
*/
public function index(User $user): Response
{
Answer the question
In order to leave comments, you need to log in
monolog has the ability to disable certain logs monolog.yaml
can more easily set default to id
defaults:
id: 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question