From 6b767d1cc0e9697af95ec399fd612d203d10826a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 26 Jan 2015 22:15:19 +0100 Subject: refactoring for fetching content --- src/Wallabag/CoreBundle/Controller/EntryController.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 2ebb416c..48d19307 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Wallabag\CoreBundle\Repository; use Wallabag\CoreBundle\Entity\Entries; +use Wallabag\CoreBundle\Service\Extractor; use Wallabag\Wallabag\Tools; use Wallabag\Wallabag\Url; @@ -32,10 +33,12 @@ class EntryController extends Controller if ($form->isValid()) { - $content = Tools::getPageContent(new Url($entry->getUrl())); - var_dump($content);die; + $content = Extractor::extract($entry->getUrl()); - $em = $this->getDoctrine()->getEntityManager(); + $entry->setTitle($content->getTitle()); + $entry->setContent($content->getBody()); + + $em = $this->getDoctrine()->getManager(); $em->persist($entry); $em->flush(); @@ -170,7 +173,7 @@ class EntryController extends Controller */ public function deleteEntryAction(Request $request, Entries $entry) { - $em = $this->getDoctrine()->getEntityManager(); + $em = $this->getDoctrine()->getManager(); $em->remove($entry); $em->flush(); -- cgit v1.2.3