fix error pages (#1209)

This commit is contained in:
Kevin Papst
2019-10-31 00:16:25 +01:00
committed by GitHub
parent f4fcfeba9d
commit 4331a7c9f4
5 changed files with 10 additions and 4 deletions

View File

@@ -7,7 +7,10 @@ home:
homeLocale: homeLocale:
path: /{_locale} path: /{_locale}
requirements:
_locale: '%app_locales%'
defaults: defaults:
_controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction _controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
_locale: '%locale%'
route: homepage route: homepage
permanent: true permanent: true

View File

@@ -73,7 +73,7 @@ class DashboardSubscriber implements EventSubscriberInterface
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array
{ {
return [ return [
DashboardEvent::DASHBOARD => ['onDashboardEvent', 100], DashboardEvent::class => ['onDashboardEvent', 100],
]; ];
} }

View File

@@ -71,7 +71,10 @@ class MenuBuilderSubscriber implements EventSubscriberInterface
new MenuItemModel('system', 'menu.system', '') new MenuItemModel('system', 'menu.system', '')
); );
// error pages don't have a user and will fail when is_granted() is called
if (null !== $event->getRequest()->getUser()) {
$this->eventDispatcher->dispatch($menuEvent); $this->eventDispatcher->dispatch($menuEvent);
}
if ($menuEvent->getAdminMenu()->hasChildren()) { if ($menuEvent->getAdminMenu()->hasChildren()) {
$event->addItem(new MenuItemModel('admin', 'menu.admin', '')); $event->addItem(new MenuItemModel('admin', 'menu.admin', ''));

View File

@@ -42,7 +42,7 @@ final class MenuSubscriber implements EventSubscriberInterface
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array
{ {
return [ return [
ConfigureMainMenuEvent::CONFIGURE => ['onMainMenuConfigure', 100], ConfigureMainMenuEvent::class => ['onMainMenuConfigure', 100],
]; ];
} }

View File

@@ -57,7 +57,7 @@ class UserPreferenceSubscriber implements EventSubscriberInterface
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array
{ {
return [ return [
PrepareUserEvent::PREPARE => ['loadUserPreferences', 200] PrepareUserEvent::class => ['loadUserPreferences', 200]
]; ];
} }