Symfony Exception

EntityNotFoundException

HTTP 404 Not Found

The "Book" entity with "id = 13" does not exist in the database. The entity may have been deleted by mistake or by a "cascade={"remove"}" operation executed by Doctrine.

Exception

EasyCorp\Bundle\EasyAdminBundle\Exception\ EntityNotFoundException

  1.         if (null === $manager $this->doctrine->getManagerForClass($entityConfig['class'])) {
  2.             throw new \RuntimeException(sprintf('There is no Doctrine Entity Manager defined for the "%s" class'$entityConfig['class']));
  3.         }
  4.         if (null === $entity $manager->getRepository($entityConfig['class'])->find($itemId)) {
  5.             throw new EntityNotFoundException(['entity_name' => $entityConfig['name'], 'entity_id_name' => $entityConfig['primary_key_field_name'], 'entity_id_value' => $itemId]);
  6.         }
  7.         return $entity;
  8.     }
  9. }
  1.         }
  2.         $request->attributes->set('easyadmin', [
  3.             'entity' => $entity $event->getArgument('entity'),
  4.             'view' => $request->query->get('action''list'),
  5.             'item' => (null !== $id $request->query->get('id')) ? $this->findCurrentItem($entity$id) : null,
  6.         ]);
  7.     }
  8.     /**
  9.      * Looks for the object that corresponds to the selected 'id' of the current entity.
  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.         foreach ($listeners as $listener) {
  2.             if ($stoppable && $event->isPropagationStopped()) {
  3.                 break;
  4.             }
  5.             $listener($event$eventName$this);
  6.         }
  7.     }
  8.     /**
  9.      * Sorts the internal list of listeners for the given event by priority.
  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.         $subject $arguments['paginator'] ?? $arguments['entity'];
  2.         $event = new GenericEvent($subject$arguments);
  3.         if (Kernel::VERSION_ID >= 40300) {
  4.             $this->get('event_dispatcher')->dispatch($event$eventName);
  5.         } else {
  6.             $this->get('event_dispatcher')->dispatch($eventName$event);
  7.         }
  8.     }
  1.         }
  2.         $this->em $this->getDoctrine()->getManagerForClass($this->entity['class']);
  3.         $this->request $request;
  4.         $this->dispatch(EasyAdminEvents::POST_INITIALIZE);
  5.     }
  6.     protected function dispatch($eventName, array $arguments = [])
  7.     {
  8.         $arguments array_replace([
  1.      *
  2.      * @throws ForbiddenActionException
  3.      */
  4.     public function indexAction(Request $request)
  5.     {
  6.         $this->initialize($request);
  7.         if (null === $request->query->get('entity')) {
  8.             return $this->redirectToBackendHomepage();
  9.         }
in vendor/symfony/http-kernel/HttpKernel.php -> indexAction (line 157)
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     public function handle(Request $requestint $type HttpKernelInterface::MASTER_REQUESTbool $catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  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 24)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

EntityNotFoundException

EasyCorp\Bundle\EasyAdminBundle\Exception\EntityNotFoundException:
The "Book" entity with "id = 13" does not exist in the database. The entity may have been deleted by mistake or by a "cascade={"remove"}" operation executed by Doctrine.

  at vendor/easycorp/easyadmin-bundle/src/EventListener/RequestPostInitializeListener.php:69
  at EasyCorp\Bundle\EasyAdminBundle\EventListener\RequestPostInitializeListener->findCurrentItem()
     (vendor/easycorp/easyadmin-bundle/src/EventListener/RequestPostInitializeListener.php:47)
  at EasyCorp\Bundle\EasyAdminBundle\EventListener\RequestPostInitializeListener->initializeRequest()
     (vendor/symfony/event-dispatcher/Debug/WrappedListener.php:117)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:230)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:59)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:151)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (vendor/easycorp/easyadmin-bundle/src/Controller/AdminControllerTrait.php:149)
  at EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController->dispatch()
     (vendor/easycorp/easyadmin-bundle/src/Controller/AdminControllerTrait.php:133)
  at EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController->initialize()
     (vendor/easycorp/easyadmin-bundle/src/Controller/AdminControllerTrait.php:65)
  at EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController->indexAction()
     (vendor/symfony/http-kernel/HttpKernel.php:157)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:79)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:195)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:24)