X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FWallabagRestController.php;h=fc13b1a8d867c961f84d7b6213cef0b561eec8ea;hb=42a9064620eb73eaa42928a22eeec86299d4a883;hp=5668d9348627e97fc9c66e6eb4af0a1fbf0fc5f8;hpb=8394ab46191f717dc9c32fecfa6809f958951dca;p=github%2Fwallabag%2Fwallabag.git 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; use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Wallabag\CoreBundle\Entity\Entries; use Wallabag\CoreBundle\Entity\Tags; use Wallabag\CoreBundle\Service\Extractor; @@ -30,6 +31,8 @@ class WallabagRestController extends Controller */ public function getEntriesAction(Request $request) { + // TODO isArchived, isStarred et isDeleted ne doivent pas avoir de valeur par défaut + // TODO Si on ne passe rien, on ne filtre pas sur le statut. $isArchived = $request->query->get('archive', 0); $isStarred = $request->query->get('star', 0); $isDeleted = $request->query->get('delete', 0); @@ -129,6 +132,16 @@ class WallabagRestController extends Controller */ public function deleteEntriesAction(Entries $entry) { + if ($entry->isDeleted()) { + throw new NotFoundHttpException('This entry is already deleted'); + } + + $em = $this->getDoctrine()->getManager(); + $entry->setDeleted(1); + $em->persist($entry); + $em->flush(); + + return $entry; } /**