Symfony Exception

Error

HTTP 500 Internal Server Error

Call to a member function getId() on null

Exception

Error

  1.                 'project' => $project,
  2.                 'status' => $active
  3.             ));
  4.             $projectdata = array(
  5.                 'id' => $project->getId(),
  6.                 'name' => $project->getName(),
  7.                 'country' => $project->getCountry()->getCode(),
  8.                 'domain' => $project->getDomain(),
  9.                 'contact' => $contact->getEmail()
  10.             );
  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 25)
  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 2

Level Channel Message
CRITICAL 23:09:37 php Uncaught Error: Call to a member function getId() on null
{
    "exception": {}
}
CRITICAL 23:09:37 request Uncaught PHP Exception Error: "Call to a member function getId() on null" at /var/www/html/leadgen/v1/src/Controller/ApiController.php line 4526
{
    "exception": {}
}

Stack Trace

Error

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

  at src/Controller/ApiController.php:4526
  at App\Controller\ApiController->content(object(Request))
     (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:25)