aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Controller/WallabagRestController.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
index eec8d32c..a6c0db37 100644
--- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
@@ -8,6 +8,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8use Symfony\Component\HttpFoundation\Request; 8use Symfony\Component\HttpFoundation\Request;
9use Wallabag\CoreBundle\Entity\Entries; 9use Wallabag\CoreBundle\Entity\Entries;
10use Wallabag\CoreBundle\Entity\Tags; 10use Wallabag\CoreBundle\Entity\Tags;
11use Wallabag\CoreBundle\Service\Extractor;
11 12
12class WallabagRestController extends Controller 13class WallabagRestController extends Controller
13{ 14{
@@ -79,9 +80,24 @@ class WallabagRestController extends Controller
79 * } 80 * }
80 * ) 81 * )
81 */ 82 */
82 public function postEntriesAction() 83 public function postEntriesAction(Request $request)
83 { 84 {
85 //TODO la récup ne marche
86 //TODO gérer si on passe le titre
87 //TODO gérer si on passe les tags
88 //TODO ne pas avoir du code comme ça qui doit se trouver dans le Repository
89 $entry = new Entries();
90 $entry->setUserId(1);
91 $content = Extractor::extract($request->request->get('url'));
84 92
93 $entry->setTitle($content->getTitle());
94 $entry->setContent($content->getBody());
95
96 $em = $this->getDoctrine()->getManager();
97 $em->persist($entry);
98 $em->flush();
99
100 return $entry;
85 } 101 }
86 102
87 /** 103 /**