From: Nicolas Lœuillet Date: Thu, 5 Feb 2015 17:05:27 +0000 (+0100) Subject: we can now set a title to the article when we use POST /api/entries X-Git-Tag: 2.0.0-alpha.0~95^2~1 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=77bb7b92a2ea71178edb03c482db33ddf179857d;p=github%2Fwallabag%2Fwallabag.git we can now set a title to the article when we use POST /api/entries --- diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php index 55906ce0..eb19f0f5 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);