From d6a7e14a054fc3c9590e98be7687136ff8b000a4 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 21 Feb 2022 16:31:52 +0100 Subject: [PATCH] Bump requirements and fix symfony/event-dispatcher usage --- composer.json | 28 ++++++++++++++++++---------- src/Event/BuildDefinitionEvent.php | 2 +- src/Event/ConvertToGeoJsonEvent.php | 2 +- src/Event/GetHashEvent.php | 2 +- src/Event/GetJavascriptEvent.php | 2 +- src/MapProvider.php | 4 ++-- src/Mapper/DefinitionMapper.php | 8 ++++---- 7 files changed, 28 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 07af2f6..42e2a57 100644 --- a/composer.json +++ b/composer.json @@ -21,9 +21,9 @@ "ext-json": "*", "ext-pdo": "*", "contao-community-alliance/meta-palettes": "^2.0 || ^1.11", - "contao/core-bundle": "~4.4", + "contao/core-bundle": "^4.9", "doctrine/cache": "^1.0", - "doctrine/dbal": "^2.5", + "doctrine/dbal": "^2.11 || ^3.0", "menatwork/contao-multicolumnwizard": "^3.3", "netzmacht/contao-leaflet-geocode-widget": "^1.2", "netzmacht/contao-leaflet-libraries": "^1.3.4", @@ -31,14 +31,15 @@ "netzmacht/contao-toolkit": "~3.0", "netzmacht/php-javascript-builder": "^1.0", "netzmacht/php-leaflet": "^1.1.0", - "symfony/config": "~3.3 || ~4.0", - "symfony/dependency-injection": "^3.4.26 || ^4.1.12", - "symfony/event-dispatcher": "~3.3 || ~4.0", - "symfony/filesystem": "~3.3 || ~4.0", - "symfony/http-kernel": "~3.3 || ~4.0", - "symfony/twig-bundle": "~3.3 || ~4.0", - "symfony/translation": "~3.3 || ~4.0", - "twig/twig": "^1.3.35 || ^2.0" + "symfony/config": "~4.4 || ^5.1", + "symfony/dependency-injection": "~4.4 || ^5.1", + "symfony/event-dispatcher": "~4.4 || ^5.1", + "symfony/event-dispatcher-contracts": "^1.1 || ^2.0", + "symfony/filesystem": "~4.4 || ^5.1", + "symfony/http-kernel": "~4.4 || ^5.1", + "symfony/twig-bundle": "~4.4 || ^5.1", + "symfony/translation": "~4.4 || ^5.1", + "twig/twig": "^2.0 || ^3.0" }, "require-dev": { "contao/manager-plugin": "^2.1", @@ -79,5 +80,12 @@ "issues": "https://github.com/netzmacht/contao-leaflet-maps/issues", "source": "https://github.com/netzmacht/contao-leaflet-maps", "docs": "http://leaflet-maps-for-contao.readthedocs.org/" + }, + "config": { + "allow-plugins": { + "contao-components/installer": true, + "contao/manager-plugin": true, + "contao-community-alliance/composer-plugin": true + } } } diff --git a/src/Event/BuildDefinitionEvent.php b/src/Event/BuildDefinitionEvent.php index 66e5abf..d494596 100644 --- a/src/Event/BuildDefinitionEvent.php +++ b/src/Event/BuildDefinitionEvent.php @@ -15,7 +15,7 @@ namespace Netzmacht\Contao\Leaflet\Event; use Contao\Model; use Netzmacht\Contao\Leaflet\Mapper\Request; use Netzmacht\LeafletPHP\Definition; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; /** * Class BuildDefinitionEvent is emitted when the mapper maps between the model and the definition. diff --git a/src/Event/ConvertToGeoJsonEvent.php b/src/Event/ConvertToGeoJsonEvent.php index de71b21..fa32112 100644 --- a/src/Event/ConvertToGeoJsonEvent.php +++ b/src/Event/ConvertToGeoJsonEvent.php @@ -14,7 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Event; use Netzmacht\LeafletPHP\Definition; use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonObject; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; /** * Class ConvertToGeoJsonEvent is emitted when the DefinitionMapper converts a definition to a geo json feature. diff --git a/src/Event/GetHashEvent.php b/src/Event/GetHashEvent.php index fac4a51..2bf0c1c 100644 --- a/src/Event/GetHashEvent.php +++ b/src/Event/GetHashEvent.php @@ -12,7 +12,7 @@ namespace Netzmacht\Contao\Leaflet\Event; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; /** * Class GetHashEvent is emitted then a hash for a data object with an unknown type is required. diff --git a/src/Event/GetJavascriptEvent.php b/src/Event/GetJavascriptEvent.php index 52099a0..0cfb2e1 100644 --- a/src/Event/GetJavascriptEvent.php +++ b/src/Event/GetJavascriptEvent.php @@ -13,7 +13,7 @@ namespace Netzmacht\Contao\Leaflet\Event; use Netzmacht\LeafletPHP\Definition\Map; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; /** * Class GetJavascriptEvent is emitted after the map javascript was created. diff --git a/src/MapProvider.php b/src/MapProvider.php index c60dc6e..89a6ba1 100644 --- a/src/MapProvider.php +++ b/src/MapProvider.php @@ -27,8 +27,8 @@ use Netzmacht\Contao\Toolkit\View\Template\TemplateReference; use Netzmacht\LeafletPHP\Definition\Map; use Netzmacht\LeafletPHP\Leaflet; use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection; -use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher; use Symfony\Component\Templating\EngineInterface as TemplateEngine; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher; /** * Class MapProvider. @@ -392,7 +392,7 @@ class MapProvider ); $event = new GetJavascriptEvent($definition, $content); - $this->eventDispatcher->dispatch($event::NAME, $event); + $this->eventDispatcher->dispatch($event, $event::NAME); return $event->getJavascript(); } diff --git a/src/Mapper/DefinitionMapper.php b/src/Mapper/DefinitionMapper.php index 331e4fe..1798f5e 100644 --- a/src/Mapper/DefinitionMapper.php +++ b/src/Mapper/DefinitionMapper.php @@ -20,7 +20,7 @@ use Netzmacht\LeafletPHP\Value\GeoJson\ConvertsToGeoJsonFeature; use Netzmacht\LeafletPHP\Value\GeoJson\Feature; use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection; use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonFeature; -use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher; /** * Class DefinitionMapper is the main mapper instance which contains all other mappers as children. @@ -111,7 +111,7 @@ class DefinitionMapper if ($definition) { $event = new BuildDefinitionEvent($definition, $model, $request); - $this->eventDispatcher->dispatch($event::NAME, $event); + $this->eventDispatcher->dispatch($event, $event::NAME); } $this->mapped[$hash] = $definition; @@ -172,7 +172,7 @@ class DefinitionMapper } $event = new ConvertToGeoJsonEvent($definition, $feature, $model); - $this->eventDispatcher->dispatch($event::NAME, $event); + $this->eventDispatcher->dispatch($event, $event::NAME); return $feature; } @@ -190,7 +190,7 @@ class DefinitionMapper private function hash($model, $elementId = null) { $event = new GetHashEvent($model); - $this->eventDispatcher->dispatch($event::NAME, $event); + $this->eventDispatcher->dispatch($event, $event::NAME); $hash = $event->getHash(); if (!$hash) {