diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 10 |
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; | |||
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\EntryUpdatedEvent; | ||
12 | use Wallabag\CoreBundle\Form\Type\EntryFilterType; | 13 | use Wallabag\CoreBundle\Form\Type\EntryFilterType; |
13 | use Wallabag\CoreBundle\Form\Type\EditEntryType; | 14 | use Wallabag\CoreBundle\Form\Type\EditEntryType; |
14 | use Wallabag\CoreBundle\Form\Type\NewEntryType; | 15 | use Wallabag\CoreBundle\Form\Type\NewEntryType; |
15 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; | 16 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; |
16 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | 17 | use Wallabag\CoreBundle\Event\EntrySavedEvent; |
17 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; | ||
18 | use Wallabag\CoreBundle\Form\Type\SearchEntryType; | 18 | use Wallabag\CoreBundle\Form\Type\SearchEntryType; |
19 | 19 | ||
20 | class EntryController extends Controller | 20 | class 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(); |