forked from wallabag/wallabag
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:
@ -18,7 +18,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
|
||||
use Wallabag\CoreBundle\Entity\InternalSetting;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
@ -282,7 +281,7 @@ class InstallCommand extends ContainerAwareCommand
|
||||
|
||||
// dispatch a created event so the associated config will be created
|
||||
$event = new UserEvent($user);
|
||||
LegacyEventDispatcherProxy::decorate($this->getContainer()->get(EventDispatcherInterface::class))->dispatch($event, FOSUserEvents::USER_CREATED);
|
||||
$this->getContainer()->get(EventDispatcherInterface::class)->dispatch($event, FOSUserEvents::USER_CREATED);
|
||||
|
||||
$this->io->text('<info>Administration successfully setup.</info>');
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
||||
$dispatcher->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry));
|
||||
$dispatcher->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
|
||||
$progressBar->advance();
|
||||
|
||||
$em->detach($entry);
|
||||
|
||||
@ -102,7 +102,7 @@ class EntryController extends Controller
|
||||
$entry->removeTag($tag);
|
||||
}
|
||||
} elseif ('delete' === $action) {
|
||||
$this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
|
||||
$this->get(EventDispatcherInterface::class)->dispatch(new EntryDeletedEvent($entry), EntryDeletedEvent::NAME);
|
||||
$em->remove($entry);
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ class EntryController extends Controller
|
||||
$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->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
@ -206,7 +206,7 @@ class EntryController extends Controller
|
||||
$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->redirect($this->generateUrl('homepage'));
|
||||
@ -414,7 +414,7 @@ class EntryController extends Controller
|
||||
$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->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
|
||||
}
|
||||
@ -498,7 +498,7 @@ class EntryController extends Controller
|
||||
);
|
||||
|
||||
// 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);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Wallabag\CoreBundle\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
||||
/**
|
||||
@ -19,7 +19,7 @@ class EntryDeletedEvent extends Event
|
||||
$this->entry = $entry;
|
||||
}
|
||||
|
||||
public function getEntry()
|
||||
public function getEntry(): Entry
|
||||
{
|
||||
return $this->entry;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Wallabag\CoreBundle\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
|
||||
/**
|
||||
@ -19,7 +19,7 @@ class EntrySavedEvent extends Event
|
||||
$this->entry = $entry;
|
||||
}
|
||||
|
||||
public function getEntry()
|
||||
public function getEntry(): Entry
|
||||
{
|
||||
return $this->entry;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user