diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 3 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/WallabagRestController.php | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 377a45ae..eb5b43ad 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -177,7 +177,8 @@ class EntryController extends Controller | |||
177 | public function deleteEntryAction(Request $request, Entries $entry) | 177 | public function deleteEntryAction(Request $request, Entries $entry) |
178 | { | 178 | { |
179 | $em = $this->getDoctrine()->getManager(); | 179 | $em = $this->getDoctrine()->getManager(); |
180 | $em->remove($entry); | 180 | $entry->setDeleted(1); |
181 | $em->persist($entry); | ||
181 | $em->flush(); | 182 | $em->flush(); |
182 | 183 | ||
183 | $this->get('session')->getFlashBag()->add( | 184 | $this->get('session')->getFlashBag()->add( |
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php index 5668d934..fc13b1a8 100644 --- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php | |||
@@ -5,6 +5,7 @@ namespace Wallabag\CoreBundle\Controller; | |||
5 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; | 5 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
7 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
8 | use Wallabag\CoreBundle\Entity\Entries; | 9 | use Wallabag\CoreBundle\Entity\Entries; |
9 | use Wallabag\CoreBundle\Entity\Tags; | 10 | use Wallabag\CoreBundle\Entity\Tags; |
10 | use Wallabag\CoreBundle\Service\Extractor; | 11 | use Wallabag\CoreBundle\Service\Extractor; |
@@ -30,6 +31,8 @@ class WallabagRestController extends Controller | |||
30 | */ | 31 | */ |
31 | public function getEntriesAction(Request $request) | 32 | public function getEntriesAction(Request $request) |
32 | { | 33 | { |
34 | // TODO isArchived, isStarred et isDeleted ne doivent pas avoir de valeur par défaut | ||
35 | // TODO Si on ne passe rien, on ne filtre pas sur le statut. | ||
33 | $isArchived = $request->query->get('archive', 0); | 36 | $isArchived = $request->query->get('archive', 0); |
34 | $isStarred = $request->query->get('star', 0); | 37 | $isStarred = $request->query->get('star', 0); |
35 | $isDeleted = $request->query->get('delete', 0); | 38 | $isDeleted = $request->query->get('delete', 0); |
@@ -129,6 +132,16 @@ class WallabagRestController extends Controller | |||
129 | */ | 132 | */ |
130 | public function deleteEntriesAction(Entries $entry) | 133 | public function deleteEntriesAction(Entries $entry) |
131 | { | 134 | { |
135 | if ($entry->isDeleted()) { | ||
136 | throw new NotFoundHttpException('This entry is already deleted'); | ||
137 | } | ||
138 | |||
139 | $em = $this->getDoctrine()->getManager(); | ||
140 | $entry->setDeleted(1); | ||
141 | $em->persist($entry); | ||
142 | $em->flush(); | ||
143 | |||
144 | return $entry; | ||
132 | } | 145 | } |
133 | 146 | ||
134 | /** | 147 | /** |