Fatal error: Call to a member function getId() on null in /var/www/hubbis.symfony/src/HomeBundle/Controller/EventController.php on line 2658

Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Error: Call to a member function getId() on null' in /var/www/hubbis.symfony/src/HomeBundle/Controller/EventController.php:2658 Stack trace: #0 {main} Next exception 'RuntimeException' with message 'Failed to start the session because headers have already been sent by "/var/www/hubbis.symfony/src/HomeBundle/Controller/EventController.php" at line 2658.' in /var/www/hubbis.symfony/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php:140 Stack trace: #0 /var/www/hubbis.symfony/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php(278): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() #1 /var/www/hubbis.symfony/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Session.php(237): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->getBag('flashes') #2 /var/www/hubbis in /var/www/hubbis.symfony/app/Resources/views/base.html.twig on line 99