aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller/EntryController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php13
1 files changed, 8 insertions, 5 deletions
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;
9use Symfony\Component\HttpFoundation\Request; 9use Symfony\Component\HttpFoundation\Request;
10use Symfony\Component\Routing\Generator\UrlGeneratorInterface; 10use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
11use Wallabag\CoreBundle\Entity\Entry; 11use Wallabag\CoreBundle\Entity\Entry;
12use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryEditedEvent;
13use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryFavouriteEvent;
14use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryReadEvent;
15use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntrySavedEvent;
12use Wallabag\CoreBundle\Form\Type\EntryFilterType; 16use Wallabag\CoreBundle\Form\Type\EntryFilterType;
13use Wallabag\CoreBundle\Form\Type\EditEntryType; 17use Wallabag\CoreBundle\Form\Type\EditEntryType;
14use Wallabag\CoreBundle\Form\Type\NewEntryType; 18use Wallabag\CoreBundle\Form\Type\NewEntryType;
15use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; 19use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
16use Wallabag\CoreBundle\Event\EntrySavedEvent;
17use Wallabag\CoreBundle\Event\EntryDeletedEvent;
18use Wallabag\CoreBundle\Form\Type\SearchEntryType; 20use Wallabag\CoreBundle\Form\Type\SearchEntryType;
19 21
20class EntryController extends Controller 22class EntryController extends Controller
@@ -405,6 +407,8 @@ class EntryController extends Controller
405 $entry->toggleArchive(); 407 $entry->toggleArchive();
406 $this->getDoctrine()->getManager()->flush(); 408 $this->getDoctrine()->getManager()->flush();
407 409
410 $this->get('event_dispatcher')->dispatch(EntryReadEvent::NAME, new EntryReadEvent($entry));
411
408 $message = 'flashes.entry.notice.entry_unarchived'; 412 $message = 'flashes.entry.notice.entry_unarchived';
409 if ($entry->isArchived()) { 413 if ($entry->isArchived()) {
410 $message = 'flashes.entry.notice.entry_archived'; 414 $message = 'flashes.entry.notice.entry_archived';
@@ -437,6 +441,8 @@ class EntryController extends Controller
437 $entry->toggleStar(); 441 $entry->toggleStar();
438 $this->getDoctrine()->getManager()->flush(); 442 $this->getDoctrine()->getManager()->flush();
439 443
444 $this->get('event_dispatcher')->dispatch(EntryFavouriteEvent::NAME, new EntryFavouriteEvent($entry));
445
440 $message = 'flashes.entry.notice.entry_unstarred'; 446 $message = 'flashes.entry.notice.entry_unstarred';
441 if ($entry->isStarred()) { 447 if ($entry->isStarred()) {
442 $message = 'flashes.entry.notice.entry_starred'; 448 $message = 'flashes.entry.notice.entry_starred';
@@ -473,9 +479,6 @@ class EntryController extends Controller
473 UrlGeneratorInterface::ABSOLUTE_PATH 479 UrlGeneratorInterface::ABSOLUTE_PATH
474 ); 480 );
475 481
476 // entry deleted, dispatch event about it!
477 $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
478
479 $em = $this->getDoctrine()->getManager(); 482 $em = $this->getDoctrine()->getManager();
480 $em->remove($entry); 483 $em->remove($entry);
481 $em->flush(); 484 $em->flush();