diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-02-24 11:34:36 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-05-30 11:47:39 +0200 |
commit | 61351218f90df455c6edcc530bfc746d60b43a12 (patch) | |
tree | abb1945e9f9c648ac686eb67bb1386eb175f72d3 /src/Wallabag/CoreBundle/Controller/TagController.php | |
parent | d181bd728565454ec53d960f321ed0a4c3bf26c8 (diff) | |
download | wallabag-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/TagController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/TagController.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index fb6a720b..e6d55931 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -9,6 +9,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |||
9 | use Symfony\Component\HttpFoundation\Request; | 9 | use Symfony\Component\HttpFoundation\Request; |
10 | use Wallabag\CoreBundle\Entity\Entry; | 10 | use Wallabag\CoreBundle\Entity\Entry; |
11 | use Wallabag\CoreBundle\Entity\Tag; | 11 | use Wallabag\CoreBundle\Entity\Tag; |
12 | use Wallabag\CoreBundle\Event\EntryTaggedEvent; | ||
12 | use Wallabag\CoreBundle\Form\Type\NewTagType; | 13 | use Wallabag\CoreBundle\Form\Type\NewTagType; |
13 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | 14 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; |
14 | 15 | ||
@@ -28,7 +29,7 @@ class TagController extends Controller | |||
28 | $form->handleRequest($request); | 29 | $form->handleRequest($request); |
29 | 30 | ||
30 | if ($form->isSubmitted() && $form->isValid()) { | 31 | if ($form->isSubmitted() && $form->isValid()) { |
31 | $this->get('wallabag_core.tags_assigner')->assignTagsToEntry( | 32 | $tags = $this->get('wallabag_core.tags_assigner')->assignTagsToEntry( |
32 | $entry, | 33 | $entry, |
33 | $form->get('label')->getData() | 34 | $form->get('label')->getData() |
34 | ); | 35 | ); |
@@ -37,6 +38,8 @@ class TagController extends Controller | |||
37 | $em->persist($entry); | 38 | $em->persist($entry); |
38 | $em->flush(); | 39 | $em->flush(); |
39 | 40 | ||
41 | $this->get('event_dispatcher')->dispatch(EntryTaggedEvent::NAME, new EntryTaggedEvent($entry, $tags)); | ||
42 | |||
40 | $this->get('session')->getFlashBag()->add( | 43 | $this->get('session')->getFlashBag()->add( |
41 | 'notice', | 44 | 'notice', |
42 | 'flashes.tag.notice.tag_added' | 45 | 'flashes.tag.notice.tag_added' |
@@ -64,6 +67,8 @@ class TagController extends Controller | |||
64 | $em = $this->getDoctrine()->getManager(); | 67 | $em = $this->getDoctrine()->getManager(); |
65 | $em->flush(); | 68 | $em->flush(); |
66 | 69 | ||
70 | $this->get('event_dispatcher')->dispatch(EntryTaggedEvent::NAME, new EntryTaggedEvent($entry, $tag)); | ||
71 | |||
67 | // remove orphan tag in case no entries are associated to it | 72 | // remove orphan tag in case no entries are associated to it |
68 | if (count($tag->getEntries()) === 0) { | 73 | if (count($tag->getEntries()) === 0) { |
69 | $em->remove($tag); | 74 | $em->remove($tag); |