diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 13 |
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; | |||
9 | use Symfony\Component\HttpFoundation\Request; | 9 | use Symfony\Component\HttpFoundation\Request; |
10 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | 10 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
11 | use Wallabag\CoreBundle\Entity\Entry; | 11 | use Wallabag\CoreBundle\Entity\Entry; |
12 | use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryEditedEvent; | ||
13 | use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryFavouriteEvent; | ||
14 | use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryReadEvent; | ||
15 | use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntrySavedEvent; | ||
12 | use Wallabag\CoreBundle\Form\Type\EntryFilterType; | 16 | use Wallabag\CoreBundle\Form\Type\EntryFilterType; |
13 | use Wallabag\CoreBundle\Form\Type\EditEntryType; | 17 | use Wallabag\CoreBundle\Form\Type\EditEntryType; |
14 | use Wallabag\CoreBundle\Form\Type\NewEntryType; | 18 | use Wallabag\CoreBundle\Form\Type\NewEntryType; |
15 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; | 19 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; |
16 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | ||
17 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; | ||
18 | use Wallabag\CoreBundle\Form\Type\SearchEntryType; | 20 | use Wallabag\CoreBundle\Form\Type\SearchEntryType; |
19 | 21 | ||
20 | class EntryController extends Controller | 22 | class 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(); |