1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Fix EventDispatcer & events

Looks like parameter for the `->dispatch(` have been flipped (event first then event name).
Define events should now extends `Symfony\Contracts\EventDispatcher\Event`
This commit is contained in:
Jeremy Benoist 2022-12-15 21:47:31 +01:00
parent 63bcf50ea7
commit d47c208743
No known key found for this signature in database
GPG key ID: 7168D5DD29F38552
15 changed files with 30 additions and 48 deletions

View file

@ -462,7 +462,7 @@ class EntryRestController extends WallabagRestController
if (false !== $entry) {
// entry deleted, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
$this->get(EventDispatcherInterface::class)->dispatch(new EntryDeletedEvent($entry), EntryDeletedEvent::NAME);
$em = $this->get('doctrine')->getManager();
$em->remove($entry);
@ -539,7 +539,7 @@ class EntryRestController extends WallabagRestController
$results[$key]['entry'] = $entry instanceof Entry ? $entry->getId() : false;
// entry saved, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry));
$this->get(EventDispatcherInterface::class)->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
}
return $this->sendResponse($results);
@ -760,7 +760,7 @@ class EntryRestController extends WallabagRestController
$em->flush();
// entry saved, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry));
$this->get(EventDispatcherInterface::class)->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
return $this->sendResponse($entry);
}
@ -976,7 +976,7 @@ class EntryRestController extends WallabagRestController
$em->flush();
// entry saved, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry));
$this->get(EventDispatcherInterface::class)->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
return $this->sendResponse($entry);
}
@ -1032,7 +1032,7 @@ class EntryRestController extends WallabagRestController
$em->flush();
// entry saved, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry));
$this->get(EventDispatcherInterface::class)->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
return $this->sendResponse($entry);
}
@ -1083,7 +1083,7 @@ class EntryRestController extends WallabagRestController
}
// entry deleted, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
$this->get(EventDispatcherInterface::class)->dispatch(new EntryDeletedEvent($entry), EntryDeletedEvent::NAME);
$em = $this->get('doctrine')->getManager();
$em->remove($entry);