aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2015-02-05 18:05:27 +0100
committerNicolas Lœuillet <nicolas@loeuillet.org>2015-02-05 18:05:27 +0100
commit77bb7b92a2ea71178edb03c482db33ddf179857d (patch)
tree39b1889ea0612ae9fbbe9715b6b4d3115b85b1d4 /src/Wallabag
parentc2e2906c8dcb83494c34d22c57f262d8f2b5f58d (diff)
downloadwallabag-77bb7b92a2ea71178edb03c482db33ddf179857d.tar.gz
wallabag-77bb7b92a2ea71178edb03c482db33ddf179857d.tar.zst
wallabag-77bb7b92a2ea71178edb03c482db33ddf179857d.zip
we can now set a title to the article when we use POST /api/entries
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Controller/WallabagRestController.php5
1 files changed, 1 insertions, 4 deletions
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
80 */ 80 */
81 public function postEntriesAction(Request $request) 81 public function postEntriesAction(Request $request)
82 { 82 {
83 //TODO la récup ne marche pas
84 //TODO gérer si on passe le titre
85 //TODO gérer si on passe les tags 83 //TODO gérer si on passe les tags
86 //TODO ne pas avoir du code comme ça qui doit se trouver dans le Repository
87 $url = $request->request->get('url'); 84 $url = $request->request->get('url');
88 85
89 $content = Extractor::extract($url); 86 $content = Extractor::extract($url);
90 $entry = new Entries(); 87 $entry = new Entries();
91 $entry->setUserId(1); 88 $entry->setUserId(1);
92 $entry->setUrl($url); 89 $entry->setUrl($url);
93 $entry->setTitle($content->getTitle()); 90 $entry->setTitle(!is_null($request->request->get('title')) ? $request->request->get('title') : $content->getTitle());
94 $entry->setContent($content->getBody()); 91 $entry->setContent($content->getBody());
95 $em = $this->getDoctrine()->getManager(); 92 $em = $this->getDoctrine()->getManager();
96 $em->persist($entry); 93 $em->persist($entry);