Symfony Exception

NotFoundHttpException

HTTP 404 Not Found

App\Entity\Product object not found by the @ParamConverter annotation.

Exception

Symfony\Component\HttpKernel\Exception\ NotFoundHttpException

  1.         if (null === $object && false === $configuration->isOptional()) {
  2.             $message sprintf('%s object not found by the @%s annotation.'$class$this->getAnnotationName($configuration));
  3.             if ($errorMessage) {
  4.                 $message .= ' '.$errorMessage;
  5.             }
  6.             throw new NotFoundHttpException($message);
  7.         }
  8.         $request->attributes->set($name$object);
  9.         return true;
  1.             return;
  2.         }
  3.         foreach ($this->all() as $converter) {
  4.             if ($converter->supports($configuration)) {
  5.                 if ($converter->apply($request$configuration)) {
  6.                     return;
  7.                 }
  8.             }
  9.         }
  10.     }
  1.         if (\is_object($configurations)) {
  2.             $configurations = [$configurations];
  3.         }
  4.         foreach ($configurations as $configuration) {
  5.             $this->applyConverter($request$configuration);
  6.         }
  7.     }
  8.     /**
  9.      * Applies converter on request based on the given configuration.
  1.         // automatically apply conversion for non-configured objects
  2.         if ($this->autoConvert) {
  3.             $configurations $this->autoConfigure($r$request$configurations);
  4.         }
  5.         $this->manager->apply($request$configurations);
  6.     }
  7.     private function autoConfigure(\ReflectionFunctionAbstract $rRequest $request$configurations)
  8.     {
  9.         foreach ($r->getParameters() as $param) {
  1.         $this->called true;
  2.         $this->priority $dispatcher->getListenerPriority($eventName$this->listener);
  3.         $e $this->stopwatch->start($this->name'event_listener');
  4.         ($this->optimizedListener ?? $this->listener)($event$eventName$dispatcher);
  5.         if ($e->isStarted()) {
  6.             $e->stop();
  7.         }
  1.     {
  2.         foreach ($listeners as $listener) {
  3.             if ($event->isPropagationStopped()) {
  4.                 break;
  5.             }
  6.             $listener($event$eventName$this);
  7.         }
  8.     }
  9.     /**
  10.      * Sorts the internal list of listeners for the given event by priority.
  1.      * @param object     $event     The event object to pass to the event handlers/listeners
  2.      */
  3.     protected function callListeners(iterable $listenersstring $eventName$event)
  4.     {
  5.         if ($event instanceof Event) {
  6.             $this->doDispatch($listeners$eventName$event);
  7.             return;
  8.         }
  9.         $stoppable $event instanceof ContractsEvent || $event instanceof StoppableEventInterface;
  1.         } else {
  2.             $listeners $this->getListeners($eventName);
  3.         }
  4.         if ($listeners) {
  5.             $this->callListeners($listeners$eventName$event);
  6.         }
  7.         return $event;
  8.     }
  1.         try {
  2.             $this->beforeDispatch($eventName$event);
  3.             try {
  4.                 $e $this->stopwatch->start($eventName'section');
  5.                 try {
  6.                     $this->dispatcher->dispatch($event$eventName);
  7.                 } finally {
  8.                     if ($e->isStarted()) {
  9.                         $e->stop();
  10.                     }
  11.                 }
  1.         if (false === $controller $this->resolver->getController($request)) {
  2.             throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". The route is wrongly configured.'$request->getPathInfo()));
  3.         }
  4.         $event = new ControllerEvent($this$controller$request$type);
  5.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER);
  6.         $controller $event->getController();
  7.         // controller arguments
  8.         $arguments $this->argumentResolver->getArguments($request$controller);
  1.     {
  2.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3.         $this->requestStack->push($request);
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle() in public/index.php (line 35)
  1.     Request::setTrustedHosts(explode(','$trustedHosts));
  2. }
  3. $kernel = new Kernel($env$debug);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

NotFoundHttpException

Symfony\Component\HttpKernel\Exception\NotFoundHttpException:
App\Entity\Product object not found by the @ParamConverter annotation.

  at vendor/sensio/framework-extra-bundle/src/Request/ParamConverter/DoctrineParamConverter.php:107
  at Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter->apply()
     (vendor/sensio/framework-extra-bundle/src/Request/ParamConverter/ParamConverterManager.php:84)
  at Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager->applyConverter()
     (vendor/sensio/framework-extra-bundle/src/Request/ParamConverter/ParamConverterManager.php:48)
  at Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager->apply()
     (vendor/sensio/framework-extra-bundle/src/EventListener/ParamConverterListener.php:72)
  at Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener->onKernelController()
     (vendor/symfony/event-dispatcher/Debug/WrappedListener.php:126)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:264)
  at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:239)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:73)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:168)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (vendor/symfony/http-kernel/HttpKernel.php:157)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:81)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:35)