aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJeremy <j0k3r@users.noreply.github.com>2015-02-05 19:07:30 +0100
committerJeremy <j0k3r@users.noreply.github.com>2015-02-05 19:07:30 +0100
commit5644c2d88e092927677c4f8c2c64db454e140431 (patch)
tree3aad333732404ceb01e70669075f4b007cfb7763 /src
parentde00c9208dddb7166eccdbf58fca1fafd9c7b392 (diff)
parent9e0fff7cb09879d7545db5d4a15da86426b8a19a (diff)
downloadwallabag-5644c2d88e092927677c4f8c2c64db454e140431.tar.gz
wallabag-5644c2d88e092927677c4f8c2c64db454e140431.tar.zst
wallabag-5644c2d88e092927677c4f8c2c64db454e140431.zip
Merge pull request #1054 from wallabag/v2-api-set-title-post
we can now set a title to the article when we use POST /api/entries
Diffstat (limited to 'src')
-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..abbf5437 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($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);