Symfony Exception

Error

HTTP 500 Internal Server Error

Call to a member function getId() on null

Exception

Error

  1.    public function singleBungalow($slug$category)
  2.    {
  3.       $bungalow                    $this->getDoctrine()->getRepository(Bungalow::Class)->findOneBy(['slug' => $slug]);
  4.       $bungalowAddFiles = array();
  5.       $bungalowAddFiles['bungalow'] = $bungalow;
  6.       $bungalowAddFiles['mainImage'] = $this->getDoctrine()->getRepository(File::class)->findOneBy(array('itemId' => $bungalow->getId(), 'section' => 'bungalow''type' => 'mainImage'));
  7.       $bungalowAddFiles['gallery']   = $this->getDoctrine()->getRepository(File::class)->findBy(array('itemId' => $bungalow->getId(), 'section' => 'bungalow''type' => 'gallery'), ['sort'=>'ASC']);
  8.       $bungalowAddFiles['mapImage']  = $this->getDoctrine()->getRepository(File::class)->findOneBy(array('itemId' => $bungalow->getId(), 'section' => 'bungalow''type' => 'mapImage'));
  9.       $relatedBungalowsList $this->getDoctrine()->getRepository(RelatedBungalow::class)->findBy(['bungalowId' => $bungalow->getId()], ['sort'=>'ASC']);
  10.       $bungalowAddFiles['stamp']     = null;
  11.       $bungalowAddFiles['stamps']    = null;
in vendor/symfony/http-kernel/HttpKernel.php->singleBungalow (line 150)
  1.         $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS$event);
  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 GetResponseForControllerResultEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch(KernelEvents::VIEW$event);
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level'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 37)
  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

Error

Error:
Call to a member function getId() on null

  at src/Controller/Frontend/StayController.php:71
  at App\Controller\Frontend\StayController->singleBungalow('coco-sweet', 'tent')
     (vendor/symfony/http-kernel/HttpKernel.php:150)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:67)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:198)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/index.php:37)