Skip to content

Commit

Permalink
Merge pull request #12 from thorau/feature/fix-event-deprecations
Browse files Browse the repository at this point in the history
Fixing further event deprecations
  • Loading branch information
bresam committed May 28, 2021
2 parents 149535b + d587c72 commit 7309e76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Helper/MapHelper.php 100644 → 100755
Expand Up @@ -59,7 +59,7 @@ public function renderJavascript(Map $map)
*/
private function doRender(Map $map, $eventName)
{
$this->getEventDispatcher()->dispatch($eventName, $event = new MapEvent($map));
$this->getEventDispatcher()->dispatch($event = new MapEvent($map), $eventName);

return $event->getCode();
}
Expand Down
5 changes: 4 additions & 1 deletion src/Helper/Subscriber/AbstractDelegateSubscriber.php 100644 → 100755
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;

/**
* @author GeLo <geloen.eric@gmail.com>
Expand All @@ -24,11 +25,13 @@ abstract class AbstractDelegateSubscriber extends AbstractSubscriber implements
*/
public function handle(Event $event, $eventName, EventDispatcherInterface $eventDispatcher)
{
$dispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);

$delegates = static::getDelegatedSubscribedEvents();

if (isset($delegates[$eventName])) {
foreach ($delegates[$eventName] as $delegate) {
$eventDispatcher->dispatch($delegate, $event);
$dispatcher->dispatch($event, $delegate);
}
}
}
Expand Down

0 comments on commit 7309e76

Please sign in to comment.