parent::__construct($registry, BlogArticle::class);
}
public function findByYearMonthName($year, $month, $name)
{
$from = new \DateTime($year . '-' . $month . '-01 00:00:00');
$to = new \DateTime($year . '-' . $month . '-31 23:59:59');
$qb = $this->createQueryBuilder('b')
->andWhere('b.createdAt BETWEEN :from AND :to')
->setParameter('from', $from)
->setParameter('to', $to)
parent::__construct($registry, BlogArticle::class);
}
public function findByYearMonthName($year, $month, $name)
{
$from = new \DateTime($year . '-' . $month . '-01 00:00:00');
$to = new \DateTime($year . '-' . $month . '-31 23:59:59');
$qb = $this->createQueryBuilder('b')
->andWhere('b.createdAt BETWEEN :from AND :to')
->setParameter('from', $from)
->setParameter('to', $to)
'year' => $year,
'month' => $month,
'name' => $this->redirects[$name]
], 301);
}
$article = $this->getDoctrine()->getRepository(BlogArticle::class)->findByYearMonthName($year, $month, $name);
if (!$article) {
if (($year == 2008 && $month < 10) || $year < 2008) {
return $this->redirectToRoute('view_blog_article', [
'year' => 2008,
$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);
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
No log messages
Exception
|
---|
Exception: Failed to parse time string (category-reisen-01 00:00:00) at position 0 (c): The timezone could not be found in the database at src/Repository/BlogArticleRepository.php:25 at DateTime->__construct() (src/Repository/BlogArticleRepository.php:25) at App\Repository\BlogArticleRepository->findByYearMonthName() (src/Controller/BlogController.php:273) at App\Controller\BlogController->viewArticle() (vendor/symfony/http-kernel/HttpKernel.php:163) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:75) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:202) at Symfony\Component\HttpKernel\Kernel->handle() (public/index.php:25) |