mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-27 10:00:29 +00:00
create entry via API
This commit is contained in:
parent
a8c90c5c1b
commit
843dbe5195
2 changed files with 21 additions and 5 deletions
8
composer.lock
generated
8
composer.lock
generated
|
@ -2283,12 +2283,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tecnickcom/TCPDF.git",
|
||||
"reference": "da2fe9359426ca334417549248307f33cd042ace"
|
||||
"reference": "a2e8f5b505a7a14a4ed960313c4baf699fd1f4bb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/da2fe9359426ca334417549248307f33cd042ace",
|
||||
"reference": "da2fe9359426ca334417549248307f33cd042ace",
|
||||
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/a2e8f5b505a7a14a4ed960313c4baf699fd1f4bb",
|
||||
"reference": "a2e8f5b505a7a14a4ed960313c4baf699fd1f4bb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2338,7 +2338,7 @@
|
|||
"pdf417",
|
||||
"qrcode"
|
||||
],
|
||||
"time": "2015-01-24 09:41:10"
|
||||
"time": "2015-01-28 18:51:40"
|
||||
},
|
||||
{
|
||||
"name": "twig/extensions",
|
||||
|
|
|
@ -8,6 +8,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Wallabag\CoreBundle\Entity\Entries;
|
||||
use Wallabag\CoreBundle\Entity\Tags;
|
||||
use Wallabag\CoreBundle\Service\Extractor;
|
||||
|
||||
class WallabagRestController extends Controller
|
||||
{
|
||||
|
@ -79,9 +80,24 @@ class WallabagRestController extends Controller
|
|||
* }
|
||||
* )
|
||||
*/
|
||||
public function postEntriesAction()
|
||||
public function postEntriesAction(Request $request)
|
||||
{
|
||||
//TODO la récup ne marche
|
||||
//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
|
||||
$entry = new Entries();
|
||||
$entry->setUserId(1);
|
||||
$content = Extractor::extract($request->request->get('url'));
|
||||
|
||||
$entry->setTitle($content->getTitle());
|
||||
$entry->setContent($content->getBody());
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
||||
return $entry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue