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
This commit is contained in:
commit
5644c2d88e
@ -80,17 +80,14 @@ class WallabagRestController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function postEntriesAction(Request $request)
|
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 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');
|
$url = $request->request->get('url');
|
||||||
|
|
||||||
$content = Extractor::extract($url);
|
$content = Extractor::extract($url);
|
||||||
$entry = new Entries();
|
$entry = new Entries();
|
||||||
$entry->setUserId(1);
|
$entry->setUserId(1);
|
||||||
$entry->setUrl($url);
|
$entry->setUrl($url);
|
||||||
$entry->setTitle($content->getTitle());
|
$entry->setTitle($request->request->get('title') ?: $content->getTitle());
|
||||||
$entry->setContent($content->getBody());
|
$entry->setContent($content->getBody());
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$em->persist($entry);
|
$em->persist($entry);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user