From 77bb7b92a2ea71178edb03c482db33ddf179857d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 5 Feb 2015 18:05:27 +0100 Subject: [PATCH] we can now set a title to the article when we use POST /api/entries --- .../CoreBundle/Controller/WallabagRestController.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php index 55906ce06..eb19f0f57 100644 --- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php @@ -80,17 +80,14 @@ class WallabagRestController extends Controller */ public function postEntriesAction(Request $request) { - //TODO la récup ne marche pas - //TODO gérer si on passe le titre //TODO gérer si on passe les tags - //TODO ne pas avoir du code comme ça qui doit se trouver dans le Repository $url = $request->request->get('url'); $content = Extractor::extract($url); $entry = new Entries(); $entry->setUserId(1); $entry->setUrl($url); - $entry->setTitle($content->getTitle()); + $entry->setTitle(!is_null($request->request->get('title')) ? $request->request->get('title') : $content->getTitle()); $entry->setContent($content->getBody()); $em = $this->getDoctrine()->getManager(); $em->persist($entry);