From bf6c0346d8d35a719dd1bff1cb4d573d422f99ff Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 31 May 2017 09:31:18 +0200 Subject: WIP Signed-off-by: Thomas Citharel --- src/Wallabag/CoreBundle/Controller/EntryController.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index fafa49f1..5e4462ed 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -9,12 +9,14 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryEditedEvent; +use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryFavouriteEvent; +use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryReadEvent; +use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntrySavedEvent; use Wallabag\CoreBundle\Form\Type\EntryFilterType; use Wallabag\CoreBundle\Form\Type\EditEntryType; use Wallabag\CoreBundle\Form\Type\NewEntryType; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; -use Wallabag\CoreBundle\Event\EntrySavedEvent; -use Wallabag\CoreBundle\Event\EntryDeletedEvent; use Wallabag\CoreBundle\Form\Type\SearchEntryType; class EntryController extends Controller @@ -405,6 +407,8 @@ class EntryController extends Controller $entry->toggleArchive(); $this->getDoctrine()->getManager()->flush(); + $this->get('event_dispatcher')->dispatch(EntryReadEvent::NAME, new EntryReadEvent($entry)); + $message = 'flashes.entry.notice.entry_unarchived'; if ($entry->isArchived()) { $message = 'flashes.entry.notice.entry_archived'; @@ -437,6 +441,8 @@ class EntryController extends Controller $entry->toggleStar(); $this->getDoctrine()->getManager()->flush(); + $this->get('event_dispatcher')->dispatch(EntryFavouriteEvent::NAME, new EntryFavouriteEvent($entry)); + $message = 'flashes.entry.notice.entry_unstarred'; if ($entry->isStarred()) { $message = 'flashes.entry.notice.entry_starred'; @@ -473,9 +479,6 @@ class EntryController extends Controller UrlGeneratorInterface::ABSOLUTE_PATH ); - // entry deleted, dispatch event about it! - $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); - $em = $this->getDoctrine()->getManager(); $em->remove($entry); $em->flush(); -- cgit v1.2.3