* @throws NonUniqueResultException
*/
public function league(EntityManagerInterface $entityManager, int $season_id, string $name): Response
{
$leagueRepository = $entityManager->getRepository('App:League');
$league = $leagueRepository->findBySeasonIdAndLeagueName($season_id, $name);
if (!$league) {
throw $this->createNotFoundException('League not found.');
}
return $this->render('main/league/single.html.twig', [
'controller_name' => 'LeagueController',
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
public function handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
No log messages
TypeError |
---|
TypeError: Return value of App\Repository\LeagueRepository::findBySeasonIdAndLeagueName() must be an instance of App\Entity\League, null returned at src/Repository/LeagueRepository.php:39 at App\Repository\LeagueRepository->findBySeasonIdAndLeagueName() (src/Controller/Main/LeagueController.php:40) at App\Controller\Main\LeagueController->league() (vendor/symfony/http-kernel/HttpKernel.php:157) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:79) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:195) at Symfony\Component\HttpKernel\Kernel->handle() (public/index.php:28) |