aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller/EntryController.php
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2017-02-24 11:34:36 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-05-30 11:47:39 +0200
commit61351218f90df455c6edcc530bfc746d60b43a12 (patch)
treeabb1945e9f9c648ac686eb67bb1386eb175f72d3 /src/Wallabag/CoreBundle/Controller/EntryController.php
parentd181bd728565454ec53d960f321ed0a4c3bf26c8 (diff)
downloadwallabag-61351218f90df455c6edcc530bfc746d60b43a12.tar.gz
wallabag-61351218f90df455c6edcc530bfc746d60b43a12.tar.zst
wallabag-61351218f90df455c6edcc530bfc746d60b43a12.zip
Save changes
PHP CS Fixed Events on changes Renamed field First draft for migration (create table Change) Added setter for tag in EntryTaggedEvent Fixed migration for Change table Added API route for entry history Removed deletion history
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();