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.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 8d2ac6d4..2a287825 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -9,12 +9,12 @@ 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\EntryUpdatedEvent;
12use Wallabag\CoreBundle\Form\Type\EntryFilterType; 13use Wallabag\CoreBundle\Form\Type\EntryFilterType;
13use Wallabag\CoreBundle\Form\Type\EditEntryType; 14use Wallabag\CoreBundle\Form\Type\EditEntryType;
14use Wallabag\CoreBundle\Form\Type\NewEntryType; 15use Wallabag\CoreBundle\Form\Type\NewEntryType;
15use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; 16use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
16use Wallabag\CoreBundle\Event\EntrySavedEvent; 17use Wallabag\CoreBundle\Event\EntrySavedEvent;
17use Wallabag\CoreBundle\Event\EntryDeletedEvent;
18use Wallabag\CoreBundle\Form\Type\SearchEntryType; 18use Wallabag\CoreBundle\Form\Type\SearchEntryType;
19 19
20class EntryController extends Controller 20class EntryController extends Controller
@@ -391,6 +391,7 @@ class EntryController extends Controller
391 $em->flush(); 391 $em->flush();
392 392
393 // entry saved, dispatch event about it! 393 // entry saved, dispatch event about it!
394 $this->get('event_dispatcher')->dispatch(EntryUpdatedEvent::NAME, new EntryUpdatedEvent($entry));
394 $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); 395 $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry));
395 396
396 return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); 397 return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
@@ -413,6 +414,8 @@ class EntryController extends Controller
413 $entry->toggleArchive(); 414 $entry->toggleArchive();
414 $this->getDoctrine()->getManager()->flush(); 415 $this->getDoctrine()->getManager()->flush();
415 416
417 $this->get('event_dispatcher')->dispatch(EntryUpdatedEvent::NAME, new EntryUpdatedEvent($entry));
418
416 $message = 'flashes.entry.notice.entry_unarchived'; 419 $message = 'flashes.entry.notice.entry_unarchived';
417 if ($entry->isArchived()) { 420 if ($entry->isArchived()) {
418 $message = 'flashes.entry.notice.entry_archived'; 421 $message = 'flashes.entry.notice.entry_archived';
@@ -445,6 +448,8 @@ class EntryController extends Controller
445 $entry->toggleStar(); 448 $entry->toggleStar();
446 $this->getDoctrine()->getManager()->flush(); 449 $this->getDoctrine()->getManager()->flush();
447 450
451 $this->get('event_dispatcher')->dispatch(EntryUpdatedEvent::NAME, new EntryUpdatedEvent($entry));
452
448 $message = 'flashes.entry.notice.entry_unstarred'; 453 $message = 'flashes.entry.notice.entry_unstarred';
449 if ($entry->isStarred()) { 454 if ($entry->isStarred()) {
450 $message = 'flashes.entry.notice.entry_starred'; 455 $message = 'flashes.entry.notice.entry_starred';
@@ -481,9 +486,6 @@ class EntryController extends Controller
481 UrlGeneratorInterface::ABSOLUTE_PATH 486 UrlGeneratorInterface::ABSOLUTE_PATH
482 ); 487 );
483 488
484 // entry deleted, dispatch event about it!
485 $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
486
487 $em = $this->getDoctrine()->getManager(); 489 $em = $this->getDoctrine()->getManager();
488 $em->remove($entry); 490 $em->remove($entry);
489 $em->flush(); 491 $em->flush();