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

@@ -10,7 +10,10 @@ Perform EACH version specific task between your version and the new one, otherwi
## [1.4](https://github.com/kevinpapst/kimai2/releases/tag/1.4) ## [1.4](https://github.com/kevinpapst/kimai2/releases/tag/1.4)
[Update as usual](https://www.kimai.org/documentation/updates.html), nothing special for this release if you upgrade from 1.0 / 1.0.1. ### Possible BC breaks
- Activate Javascript select component by default
- Switched to Symfony 4.3 event types, this could fail in plugins only if they didn't use the official constants for event names
## [1.3](https://github.com/kevinpapst/kimai2/releases/tag/1.3) ## [1.3](https://github.com/kevinpapst/kimai2/releases/tag/1.3)

View File

@@ -24,7 +24,7 @@
"gedmo/doctrine-extensions": "^2.4", "gedmo/doctrine-extensions": "^2.4",
"jms/metadata": "^2.0", "jms/metadata": "^2.0",
"jms/serializer-bundle": "^3.2", "jms/serializer-bundle": "^3.2",
"kevinpapst/adminlte-bundle": "~2.6", "kevinpapst/adminlte-bundle": "~3.0",
"kimai/kimai2-composer": "^0.1", "kimai/kimai2-composer": "^0.1",
"mpdf/mpdf": "^7.1", "mpdf/mpdf": "^7.1",
"nelmio/api-doc-bundle": "^3.2", "nelmio/api-doc-bundle": "^3.2",

104
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "668ca17f66c2121beab3c867b7aa21f9", "content-hash": "36497a607713888a9a39731a007a9b90",
"packages": [ "packages": [
{ {
"name": "beberlei/doctrineextensions", "name": "beberlei/doctrineextensions",
@@ -1070,16 +1070,16 @@
}, },
{ {
"name": "doctrine/orm", "name": "doctrine/orm",
"version": "v2.6.3", "version": "v2.6.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/orm.git", "url": "https://github.com/doctrine/orm.git",
"reference": "434820973cadf2da2d66e7184be370084cc32ca8" "reference": "b52ef5a1002f99ab506a5a2d6dba5a2c236c5f43"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/orm/zipball/434820973cadf2da2d66e7184be370084cc32ca8", "url": "https://api.github.com/repos/doctrine/orm/zipball/b52ef5a1002f99ab506a5a2d6dba5a2c236c5f43",
"reference": "434820973cadf2da2d66e7184be370084cc32ca8", "reference": "b52ef5a1002f99ab506a5a2d6dba5a2c236c5f43",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1094,9 +1094,8 @@
"symfony/console": "~3.0|~4.0" "symfony/console": "~3.0|~4.0"
}, },
"require-dev": { "require-dev": {
"doctrine/coding-standard": "^1.0", "doctrine/coding-standard": "^5.0",
"phpunit/phpunit": "^6.5", "phpunit/phpunit": "^7.5",
"squizlabs/php_codesniffer": "^3.2",
"symfony/yaml": "~3.4|~4.0" "symfony/yaml": "~3.4|~4.0"
}, },
"suggest": { "suggest": {
@@ -1121,6 +1120,10 @@
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{ {
"name": "Roman Borschel", "name": "Roman Borschel",
"email": "roman@code-factory.org" "email": "roman@code-factory.org"
@@ -1129,10 +1132,6 @@
"name": "Benjamin Eberlei", "name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de" "email": "kontakt@beberlei.de"
}, },
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{ {
"name": "Jonathan Wage", "name": "Jonathan Wage",
"email": "jonwage@gmail.com" "email": "jonwage@gmail.com"
@@ -1148,7 +1147,7 @@
"database", "database",
"orm" "orm"
], ],
"time": "2018-11-20T23:46:46+00:00" "time": "2019-09-20T14:30:26+00:00"
}, },
{ {
"name": "doctrine/persistence", "name": "doctrine/persistence",
@@ -2596,16 +2595,16 @@
}, },
{ {
"name": "jms/metadata", "name": "jms/metadata",
"version": "2.0.0", "version": "2.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/schmittjoh/metadata.git", "url": "https://github.com/schmittjoh/metadata.git",
"reference": "e918c3a65105f73b74d94a0837b9f7d611d5bf0c" "reference": "8d8958103485c2cbdd9a9684c3869312ebdaf73a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/schmittjoh/metadata/zipball/e918c3a65105f73b74d94a0837b9f7d611d5bf0c", "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/8d8958103485c2cbdd9a9684c3869312ebdaf73a",
"reference": "e918c3a65105f73b74d94a0837b9f7d611d5bf0c", "reference": "8d8958103485c2cbdd9a9684c3869312ebdaf73a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2633,13 +2632,13 @@
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
},
{ {
"name": "Johannes M. Schmitt", "name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com" "email": "schmittjoh@gmail.com"
},
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
} }
], ],
"description": "Class/method/property metadata management in PHP", "description": "Class/method/property metadata management in PHP",
@@ -2649,20 +2648,20 @@
"xml", "xml",
"yaml" "yaml"
], ],
"time": "2018-11-09T13:57:43+00:00" "time": "2019-09-17T15:30:40+00:00"
}, },
{ {
"name": "jms/serializer", "name": "jms/serializer",
"version": "3.2.0", "version": "3.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/schmittjoh/serializer.git", "url": "https://github.com/schmittjoh/serializer.git",
"reference": "89fc2a7f53ae63b513e2339fdb6db6e49bfbc749" "reference": "4c1e4296734385af7718ca71ec0febb4815b4a87"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/schmittjoh/serializer/zipball/89fc2a7f53ae63b513e2339fdb6db6e49bfbc749", "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/4c1e4296734385af7718ca71ec0febb4815b4a87",
"reference": "89fc2a7f53ae63b513e2339fdb6db6e49bfbc749", "reference": "4c1e4296734385af7718ca71ec0febb4815b4a87",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2702,7 +2701,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "3.3-dev"
} }
}, },
"autoload": { "autoload": {
@@ -2733,7 +2732,7 @@
"serialization", "serialization",
"xml" "xml"
], ],
"time": "2019-09-04T10:17:24+00:00" "time": "2019-09-20T14:24:07+00:00"
}, },
{ {
"name": "jms/serializer-bundle", "name": "jms/serializer-bundle",
@@ -2810,23 +2809,23 @@
}, },
{ {
"name": "kevinpapst/adminlte-bundle", "name": "kevinpapst/adminlte-bundle",
"version": "2.8.5", "version": "3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/kevinpapst/AdminLTEBundle.git", "url": "https://github.com/kevinpapst/AdminLTEBundle.git",
"reference": "12c5deaad9276458a2536da281732d70e5255441" "reference": "d1e0d21b497b7bf864138aba4b645379e6b51b83"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/kevinpapst/AdminLTEBundle/zipball/12c5deaad9276458a2536da281732d70e5255441", "url": "https://api.github.com/repos/kevinpapst/AdminLTEBundle/zipball/d1e0d21b497b7bf864138aba4b645379e6b51b83",
"reference": "12c5deaad9276458a2536da281732d70e5255441", "reference": "d1e0d21b497b7bf864138aba4b645379e6b51b83",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1.3", "php": "^7.1.3",
"symfony/config": ">4.0", "symfony/config": ">4.1",
"symfony/dependency-injection": ">4.0", "symfony/dependency-injection": ">4.0",
"symfony/event-dispatcher": ">4.0", "symfony/event-dispatcher": ">4.3",
"symfony/http-foundation": ">4.0", "symfony/http-foundation": ">4.0",
"symfony/http-kernel": ">4.0", "symfony/http-kernel": ">4.0",
"symfony/options-resolver": ">4.0", "symfony/options-resolver": ">4.0",
@@ -2838,7 +2837,7 @@
"knplabs/knp-menu-bundle": "^2.2", "knplabs/knp-menu-bundle": "^2.2",
"phpspec/prophecy": "^1.6", "phpspec/prophecy": "^1.6",
"phpstan/phpstan": "^0.11.8", "phpstan/phpstan": "^0.11.8",
"phpstan/phpstan-phpunit": "^0.11.2", "phpstan/phpstan-phpunit": "^0.11",
"phpunit/phpunit": "^7.3", "phpunit/phpunit": "^7.3",
"symfony/framework-bundle": ">4.0" "symfony/framework-bundle": ">4.0"
}, },
@@ -2871,7 +2870,7 @@
} }
], ],
"description": "Admin theme bundle for Symfony 4 based on AdminLTE 2.4.8 with FOSUserBundle support", "description": "Admin theme bundle for Symfony 4 based on AdminLTE 2.4.8 with FOSUserBundle support",
"time": "2019-08-08T08:09:47+00:00" "time": "2019-09-25T16:11:41+00:00"
}, },
{ {
"name": "kimai/kimai2-composer", "name": "kimai/kimai2-composer",
@@ -5459,16 +5458,16 @@
}, },
{ {
"name": "symfony/flex", "name": "symfony/flex",
"version": "v1.4.5", "version": "v1.4.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/flex.git", "url": "https://github.com/symfony/flex.git",
"reference": "4467ab35c82edebac58fe58c22cea166a805eb1f" "reference": "133e649fdf08aeb8741be1ba955ccbe5cd17c696"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/flex/zipball/4467ab35c82edebac58fe58c22cea166a805eb1f", "url": "https://api.github.com/repos/symfony/flex/zipball/133e649fdf08aeb8741be1ba955ccbe5cd17c696",
"reference": "4467ab35c82edebac58fe58c22cea166a805eb1f", "reference": "133e649fdf08aeb8741be1ba955ccbe5cd17c696",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -5504,7 +5503,7 @@
} }
], ],
"description": "Composer plugin for Symfony", "description": "Composer plugin for Symfony",
"time": "2019-07-19T08:59:18+00:00" "time": "2019-09-19T14:55:57+00:00"
}, },
{ {
"name": "symfony/form", "name": "symfony/form",
@@ -10080,16 +10079,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "0.11.15", "version": "0.11.16",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "1be5b3a706db16ac472a4c40ec03cf4c810b118d" "reference": "635cf20f3b92ce34ee94a8d2f282d62eb9dc6e1b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1be5b3a706db16ac472a4c40ec03cf4c810b118d", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/635cf20f3b92ce34ee94a8d2f282d62eb9dc6e1b",
"reference": "1be5b3a706db16ac472a4c40ec03cf4c810b118d", "reference": "635cf20f3b92ce34ee94a8d2f282d62eb9dc6e1b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -10141,8 +10140,7 @@
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"PHPStan\\": [ "PHPStan\\": [
"src/", "src/"
"build/PHPStan"
] ]
} }
}, },
@@ -10151,7 +10149,7 @@
"MIT" "MIT"
], ],
"description": "PHPStan - PHP Static Analysis Tool", "description": "PHPStan - PHP Static Analysis Tool",
"time": "2019-08-18T20:51:53+00:00" "time": "2019-09-17T11:19:51+00:00"
}, },
{ {
"name": "phpstan/phpstan-doctrine", "name": "phpstan/phpstan-doctrine",
@@ -10548,16 +10546,16 @@
}, },
{ {
"name": "phpunit/php-token-stream", "name": "phpunit/php-token-stream",
"version": "3.1.0", "version": "3.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git", "url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "e899757bb3df5ff6e95089132f32cd59aac2220a" "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e899757bb3df5ff6e95089132f32cd59aac2220a", "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff",
"reference": "e899757bb3df5ff6e95089132f32cd59aac2220a", "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -10593,7 +10591,7 @@
"keywords": [ "keywords": [
"tokenizer" "tokenizer"
], ],
"time": "2019-07-25T05:29:42+00:00" "time": "2019-09-17T06:23:10+00:00"
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",

View File

@@ -88,7 +88,7 @@ class DashboardController extends AbstractController
$event->addSection($row); $event->addSection($row);
} }
$this->eventDispatcher->dispatch($event, DashboardEvent::DASHBOARD); $this->eventDispatcher->dispatch($event);
$sections = $event->getSections(); $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 // we need to prepare the user preferences, which is done via an EventSubscriber
$event = new PrepareUserEvent($profile); $event = new PrepareUserEvent($profile);
$this->dispatcher->dispatch($event, PrepareUserEvent::PREPARE); $this->dispatcher->dispatch($event);
$original = []; $original = [];
foreach ($profile->getPreferences() as $preference) { 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 // we need to prepare the user preferences, which is done via an EventSubscriber
$event = new PrepareUserEvent($user); $event = new PrepareUserEvent($user);
$this->dispatcher->dispatch($event, PrepareUserEvent::PREPARE); $this->dispatcher->dispatch($event);
return $this->createForm( return $this->createForm(
UserPreferencesForm::class, UserPreferencesForm::class,

View File

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

View File

@@ -19,7 +19,10 @@ use Symfony\Contracts\EventDispatcher\Event;
*/ */
final class ConfigureMainMenuEvent extends 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 * @var Request

View File

@@ -15,7 +15,10 @@ use Symfony\Contracts\EventDispatcher\Event;
final class DashboardEvent extends 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 * @var User

View File

@@ -17,7 +17,10 @@ use Symfony\Contracts\EventDispatcher\Event;
*/ */
final class PrepareUserEvent extends 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 * @var User

View File

@@ -17,7 +17,10 @@ use Symfony\Contracts\EventDispatcher\Event;
*/ */
final class SystemConfigurationEvent extends 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[] * @var SystemConfiguration[]

View File

@@ -18,7 +18,10 @@ use Symfony\Contracts\EventDispatcher\Event;
*/ */
final class UserPreferenceEvent extends 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 * @var User

View File

@@ -11,7 +11,6 @@ namespace App\EventSubscriber;
use App\Event\ConfigureMainMenuEvent; use App\Event\ConfigureMainMenuEvent;
use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent; use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent;
use KevinPapst\AdminLTEBundle\Event\ThemeEvents;
use KevinPapst\AdminLTEBundle\Model\MenuItemModel; use KevinPapst\AdminLTEBundle\Model\MenuItemModel;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -48,7 +47,7 @@ class MenuBuilderSubscriber implements EventSubscriberInterface
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array
{ {
return [ 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', '') new MenuItemModel('system', 'menu.system', '')
); );
$this->eventDispatcher->dispatch($menuEvent, ConfigureMainMenuEvent::CONFIGURE); $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

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

View File

@@ -62,7 +62,7 @@ class UserProfileSubscriber implements EventSubscriberInterface
$user = $this->storage->getToken()->getUser(); $user = $this->storage->getToken()->getUser();
$event = new PrepareUserEvent($user); $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') ->orderBy('t.end', 'DESC')
; ;
return $this->getHydratedResultsByQuery($qb, false); return $this->getHydratedResultsByQuery($qb, true);
} }
/** /**

View File

@@ -22,7 +22,7 @@ class PrepareUserEventTest extends TestCase
{ {
$user = new User(); $user = new User();
$sut = new PrepareUserEvent($user); $sut = new PrepareUserEvent($user);
$this->assertEquals('app.prepare_user', PrepareUserEvent::PREPARE); $this->assertEquals(PrepareUserEvent::class, PrepareUserEvent::PREPARE);
$this->assertSame($user, $sut->getUser()); $this->assertSame($user, $sut->getUser());
} }
} }