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/Shop/Catalog/ProductRepository.php (line 195)
  1.             ->andWhere('trans.url = :url')
  2.             ->setParameter(':lang'$language)
  3.             ->setParameter(':url'$url)
  4.             ->setMaxResults(1)
  5.             ->getQuery()
  6.             ->getSingleResult()
  7.             ;
  8.     }
  9. }
ProductRepository->showOneByUrl('hu', 'naturelle-opus-aloe-3d-4z') in src/Controller/Shop/Catalog/ProductController.php (line 60)
  1.     /**
  2.      * @Route("/product/{url}", name="shop_app_product_show", methods={"GET","POST"})
  3.      */
  4.     public function show(Request $requestProductRepository $productRepositoryVariationItemRepository $variationItemRepository): Response
  5.     {
  6.         $product $productRepository->showOneByUrl($request->getLocale(), $request->get('url'));
  7.         $variations $variationItemRepository->createQueryBuilder('item')
  8.             ->join('item.products''product')
  9.             ->join('item.variation''variation')
  10.             ->join('variation.translations''variation_trans')
  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 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

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/Shop/Catalog/ProductRepository.php:195)
  at App\Repository\Shop\Catalog\ProductRepository->showOneByUrl('hu', 'naturelle-opus-aloe-3d-4z')
     (src/Controller/Shop/Catalog/ProductController.php:60)
  at App\Controller\Shop\Catalog\ProductController->show(object(Request), object(ProductRepository), object(VariationItemRepository))
     (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:24)