Symfony Exception

NoResultException

HTTP 500 Internal Server Error

No result was found for query although at least one row was expected.

Exception

Doctrine\ORM\ NoResultException

  1.     public function getSingleResult($hydrationMode null)
  2.     {
  3.         $result $this->execute(null$hydrationMode);
  4.         if ($this->_hydrationMode !== self::HYDRATE_SINGLE_SCALAR && ! $result) {
  5.             throw new NoResultException;
  6.         }
  7.         if ( ! is_array($result)) {
  8.             return $result;
  9.         }
AbstractQuery->getSingleResult() in src/Repository/Extension/FoundationRepository.php (line 85)
  1.             ->andWhere('trans.url = :url')
  2.             ->setParameter(':lang'$language)
  3.             ->setParameter(':url'$url)
  4.             ->setMaxResults(1)
  5.             ->getQuery()
  6.             ->getSingleResult()
  7.             ;
  8.     }
  9. }
FoundationRepository->showOneByUrl('hu', 'herosz-allatmenhely') in src/Controller/FoundationController.php (line 77)
  1.     /**
  2.      * @Route("/foundation/{url}", name="foundation_app_show")
  3.      */
  4.     public function show(Request $requestFoundationRepository $foundationRepository): Response
  5.     {
  6.         $foundation $foundationRepository->showOneByUrl($request->getLocale(), $request->get('url'));
  7.         return $this->render('foundation/app/show.html.twig', ['foundation' => $foundation]);
  8.     }
  9.     /**
  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 $request$type HttpKernelInterface::MASTER_REQUEST$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(object(Request)) in public/index.php (line 27)
  1. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  2. $request Request::createFromGlobals();
  3. $response $kernel->handle($request);
  4. /*$response->setCache([
  5.     'max_age' => 31536000,
  6. ]);*/
  7. $response->send();
  8. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

NoResultException

Doctrine\ORM\NoResultException:
No result was found for query although at least one row was expected.

  at vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:837
  at Doctrine\ORM\AbstractQuery->getSingleResult()
     (src/Repository/Extension/FoundationRepository.php:85)
  at App\Repository\Extension\FoundationRepository->showOneByUrl('hu', 'herosz-allatmenhely')
     (src/Controller/FoundationController.php:77)
  at App\Controller\FoundationController->show(object(Request), object(FoundationRepository))
     (vendor/symfony/http-kernel/HttpKernel.php:158)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:80)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/index.php:27)