diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/WallabagRestController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/WallabagRestController.php | 13 |
1 files changed, 13 insertions, 0 deletions
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 | /** |