updated theme, fix deprecations in events dispatching (#1145)

This commit is contained in:
Kevin Papst
2019-09-25 19:12:12 +02:00
committed by GitHub
parent d661c8b54e
commit 8d81a394ee
16 changed files with 86 additions and 71 deletions

View File

@@ -88,7 +88,7 @@ class DashboardController extends AbstractController
$event->addSection($row);
}
$this->eventDispatcher->dispatch($event, DashboardEvent::DASHBOARD);
$this->eventDispatcher->dispatch($event);
$sections = $event->getSections();

View File

@@ -207,7 +207,7 @@ class ProfileController extends AbstractController
{
// we need to prepare the user preferences, which is done via an EventSubscriber
$event = new PrepareUserEvent($profile);
$this->dispatcher->dispatch($event, PrepareUserEvent::PREPARE);
$this->dispatcher->dispatch($event);
$original = [];
foreach ($profile->getPreferences() as $preference) {
@@ -303,7 +303,7 @@ class ProfileController extends AbstractController
{
// we need to prepare the user preferences, which is done via an EventSubscriber
$event = new PrepareUserEvent($user);
$this->dispatcher->dispatch($event, PrepareUserEvent::PREPARE);
$this->dispatcher->dispatch($event);
return $this->createForm(
UserPreferencesForm::class,

View File

@@ -169,7 +169,7 @@ class SystemConfigurationController extends AbstractController
$types = $this->getConfigurationTypes();
$event = new SystemConfigurationEvent($types);
$this->eventDispatcher->dispatch($event, SystemConfigurationEvent::CONFIGURE);
$this->eventDispatcher->dispatch($event);
foreach ($event->getConfigurations() as $configs) {
foreach ($configs->getConfiguration() as $config) {

View File

@@ -19,7 +19,10 @@ use Symfony\Contracts\EventDispatcher\Event;
*/
final class ConfigureMainMenuEvent extends Event
{
public const CONFIGURE = 'app.main_menu_configure';
/**
* @deprecated since 1.4, will be removed with 2.0
*/
public const CONFIGURE = ConfigureMainMenuEvent::class;
/**
* @var Request

View File

@@ -15,7 +15,10 @@ use Symfony\Contracts\EventDispatcher\Event;
final class DashboardEvent extends Event
{
public const DASHBOARD = 'app.dashboard';
/**
* @deprecated since 1.4, will be removed with 2.0
*/
public const DASHBOARD = DashboardEvent::class;
/**
* @var User

View File

@@ -17,7 +17,10 @@ use Symfony\Contracts\EventDispatcher\Event;
*/
final class PrepareUserEvent extends Event
{
public const PREPARE = 'app.prepare_user';
/**
* @deprecated since 1.4, will be removed with 2.0
*/
public const PREPARE = PrepareUserEvent::class;
/**
* @var User

View File

@@ -17,7 +17,10 @@ use Symfony\Contracts\EventDispatcher\Event;
*/
final class SystemConfigurationEvent extends Event
{
public const CONFIGURE = 'app.system_configuration';
/**
* @deprecated since 1.4, will be removed with 2.0
*/
public const CONFIGURE = SystemConfigurationEvent::class;
/**
* @var SystemConfiguration[]

View File

@@ -18,7 +18,10 @@ use Symfony\Contracts\EventDispatcher\Event;
*/
final class UserPreferenceEvent extends Event
{
public const CONFIGURE = 'app.user_preferences';
/**
* @deprecated since 1.4, will be removed with 2.0
*/
public const CONFIGURE = UserPreferenceEvent::class;
/**
* @var User

View File

@@ -11,7 +11,6 @@ namespace App\EventSubscriber;
use App\Event\ConfigureMainMenuEvent;
use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent;
use KevinPapst\AdminLTEBundle\Event\ThemeEvents;
use KevinPapst\AdminLTEBundle\Model\MenuItemModel;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -48,7 +47,7 @@ class MenuBuilderSubscriber implements EventSubscriberInterface
public static function getSubscribedEvents(): array
{
return [
ThemeEvents::THEME_SIDEBAR_SETUP_MENU => ['onSetupNavbar', 100],
SidebarMenuEvent::class => ['onSetupNavbar', 100],
];
}
@@ -72,7 +71,7 @@ class MenuBuilderSubscriber implements EventSubscriberInterface
new MenuItemModel('system', 'menu.system', '')
);
$this->eventDispatcher->dispatch($menuEvent, ConfigureMainMenuEvent::CONFIGURE);
$this->eventDispatcher->dispatch($menuEvent);
if ($menuEvent->getAdminMenu()->hasChildren()) {
$event->addItem(new MenuItemModel('admin', 'menu.admin', ''));

View File

@@ -163,7 +163,7 @@ class UserPreferenceSubscriber implements EventSubscriberInterface
}
$event = new UserPreferenceEvent($user, $this->getDefaultPreferences($user));
$this->eventDispatcher->dispatch($event, UserPreferenceEvent::CONFIGURE);
$this->eventDispatcher->dispatch($event);
foreach ($event->getPreferences() as $preference) {
/* @var UserPreference[] $prefs */

View File

@@ -62,7 +62,7 @@ class UserProfileSubscriber implements EventSubscriberInterface
$user = $this->storage->getToken()->getUser();
$event = new PrepareUserEvent($user);
$this->eventDispatcher->dispatch($event, PrepareUserEvent::PREPARE);
$this->eventDispatcher->dispatch($event);
}
/**

View File

@@ -750,7 +750,7 @@ class TimesheetRepository extends EntityRepository
->orderBy('t.end', 'DESC')
;
return $this->getHydratedResultsByQuery($qb, false);
return $this->getHydratedResultsByQuery($qb, true);
}
/**