Skip to content

Commit

Permalink
Update symfony 4.4.x compability.
Browse files Browse the repository at this point in the history
  • Loading branch information
koftikes committed Mar 15, 2020
1 parent 164389a commit c88c126
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ before_script:
- composer install --prefer-dist --no-interaction

script:
# - vendor/bin/phpstan analyse --no-progress -c phpstan.neon -l max src
- vendor/bin/phpstan analyse --no-progress -c phpstan.neon -l max src
- vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --using-cache=no
34 changes: 0 additions & 34 deletions src/Event/ThemeEvents.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/Resources/docs/navbar_menu.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Navbar Menu Component

Since AdminLTE version 3.0.x bundle support two menus: SidebarMenu and NavbarMenu. For now, this menu doesn't support sub menu items.
Since AdminLTE version 3.0.x bundle support two menus: SidebarMenu and NavbarMenu (doesn't support sub menu items).

### Data Model
In order to use this component, your have to create each menu item using MenuItemModel class `SbS\AdminLTEBundle\Model\MenuItemModel`.
Expand Down Expand Up @@ -94,5 +94,5 @@ Finally, you need to attach your new listener to the event system:
# config/services.yaml
App\EventListener\NavbarMenuEventListener:
tags:
- { name: kernel.event_listener, event: sbs.admin_lte.navbar_menu, method: onShowMenu }
- { name: kernel.event_listener, method: onShowMenu }
```
2 changes: 1 addition & 1 deletion src/Resources/docs/navbar_notification_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ Finally, you need to attach your new listener to the event system:
# config/services.yml
App\EventListener\NotificationListEventListener:
tags:
- { name: kernel.event_listener, event: sbs.admin_lte.notifications, method: onListNotifications }
- { name: kernel.event_listener, method: onListNotifications }
```
2 changes: 1 addition & 1 deletion src/Resources/docs/navbar_task_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ Finally, you need to attach your new listener to the event system:
# config/services.yml
App\EventListener\TaskListEventListener:
tags:
- { name: kernel.event_listener, event: sbs.admin_lte.tasks, method: onListTasks }
- { name: kernel.event_listener, method: onListTasks }
```
4 changes: 2 additions & 2 deletions src/Resources/docs/navbar_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You could use the following route stubs with your `routing.yml`
# app/config/routing.yml
sbs_adminlte_user_profile:
path: /user/profile
defaults: {_controller: AppBundle:Profile:main}
controller: App\Controller\UserProfile:main
sbs_adminlte_user_logout:
path: /logout
```
Expand Down Expand Up @@ -75,7 +75,7 @@ Finally, you need to attach your new listener to the event system:
# config/services.yml
App\EventListener\UserEventListener:
tags:
- { name: kernel.event_listener, event: sbs.admin_lte.user, method: onShowUser }
- { name: kernel.event_listener, method: onShowUser }
```

[1]: https://github.com/FriendsOfSymfony/FOSUserBundle
2 changes: 1 addition & 1 deletion src/Resources/docs/sidebar_menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ Finally, you need to attach your new listener to the event system:
# config/services.yml
App\EventListener\SidebarMenuEventListener:
tags:
- { name: kernel.event_listener, event: sbs.admin_lte.sidebar_menu, method: onShowMenu }
- { name: kernel.event_listener, method: onShowMenu }
```
17 changes: 8 additions & 9 deletions src/Twig/NavBarExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use SbS\AdminLTEBundle\Event\NavbarMenuEvent;
use SbS\AdminLTEBundle\Event\NotificationListEvent;
use SbS\AdminLTEBundle\Event\TaskListEvent;
use SbS\AdminLTEBundle\Event\ThemeEvents;
use SbS\AdminLTEBundle\Event\UserEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -83,12 +82,12 @@ public function getFunctions()
*/
public function navbarMenu(Environment $environment, Request $request)
{
if (false === $this->checkListener(ThemeEvents::NAVBAR_MENU)) {
if (false === $this->checkListener(NavbarMenuEvent::class)) {
return '';
}

/** @var NavbarMenuEvent $menuEvent */
$menuEvent = $this->getDispatcher()->dispatch(new NavbarMenuEvent($request), ThemeEvents::NAVBAR_MENU);
$menuEvent = $this->getDispatcher()->dispatch(new NavbarMenuEvent($request));

return $environment->render('@SbSAdminLTE/NavBar/menu.html.twig', ['menu' => $menuEvent->getItems()]);
}
Expand All @@ -104,12 +103,12 @@ public function navbarMenu(Environment $environment, Request $request)
*/
public function showNotifications(Environment $environment)
{
if (false === $this->checkListener(ThemeEvents::NOTICES)) {
if (false === $this->checkListener(NotificationListEvent::class)) {
return '';
}

/** @var NotificationListEvent $noticesEvent */
$noticesEvent = $this->getDispatcher()->dispatch(new NotificationListEvent(), ThemeEvents::NOTICES);
$noticesEvent = $this->getDispatcher()->dispatch(new NotificationListEvent());

return $environment->render('@SbSAdminLTE/NavBar/notifications.html.twig', [
'notifications' => $noticesEvent->getNotifications(),
Expand All @@ -128,12 +127,12 @@ public function showNotifications(Environment $environment)
*/
public function showTasks(Environment $environment)
{
if (false === $this->checkListener(ThemeEvents::TASKS)) {
if (false === $this->checkListener(TaskListEvent::class)) {
return '';
}

/** @var TaskListEvent $tasksEvent */
$tasksEvent = $this->getDispatcher()->dispatch(new TaskListEvent(), ThemeEvents::TASKS);
$tasksEvent = $this->getDispatcher()->dispatch(new TaskListEvent());

return $environment->render('@SbSAdminLTE/NavBar/tasks.html.twig', [
'tasks' => $tasksEvent->getTasks(),
Expand All @@ -152,12 +151,12 @@ public function showTasks(Environment $environment)
*/
public function showUserAccount(Environment $environment)
{
if (false === $this->checkListener(ThemeEvents::USER)) {
if (false === $this->checkListener(UserEvent::class)) {
return '';
}

/** @var UserEvent $userEvent */
$userEvent = $this->getDispatcher()->dispatch(new UserEvent(), ThemeEvents::USER);
$userEvent = $this->getDispatcher()->dispatch(new UserEvent());

return $environment->render('@SbSAdminLTE/NavBar/user.html.twig', ['user' => $userEvent->getUser()]);
}
Expand Down
5 changes: 2 additions & 3 deletions src/Twig/SideBarExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace SbS\AdminLTEBundle\Twig;

use SbS\AdminLTEBundle\Event\SidebarMenuEvent;
use SbS\AdminLTEBundle\Event\ThemeEvents;
use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Component\HttpFoundation\Request;
use Twig\Environment;
Expand Down Expand Up @@ -53,12 +52,12 @@ public function getFunctions()
*/
public function sidebarMenu(Environment $environment, Request $request)
{
if (false === $this->checkListener(ThemeEvents::SIDEBAR_MENU)) {
if (false === $this->checkListener(SidebarMenuEvent::class)) {
return '';
}

/** @var SidebarMenuEvent $menuEvent */
$menuEvent = $this->getDispatcher()->dispatch(new SidebarMenuEvent($request), ThemeEvents::SIDEBAR_MENU);
$menuEvent = $this->getDispatcher()->dispatch(new SidebarMenuEvent($request));

return $environment->render('@SbSAdminLTE/SideBar/menu.html.twig', ['menu' => $menuEvent->getItems()]);
}
Expand Down

0 comments on commit c88c126

Please sign in to comment.