diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-26 22:15:19 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-01-26 22:15:19 +0100 |
commit | 6b767d1cc0e9697af95ec399fd612d203d10826a (patch) | |
tree | 5257200fa45da0218a9c63f0738f18eb6c876775 /src/Wallabag/CoreBundle/Controller/EntryController.php | |
parent | ad4d1caa9e744af57ca58a4e57576533eb682d00 (diff) | |
download | wallabag-6b767d1cc0e9697af95ec399fd612d203d10826a.tar.gz wallabag-6b767d1cc0e9697af95ec399fd612d203d10826a.tar.zst wallabag-6b767d1cc0e9697af95ec399fd612d203d10826a.zip |
refactoring for fetching content
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 11 |
1 files changed, 7 insertions, 4 deletions
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; | |||
7 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | use Wallabag\CoreBundle\Repository; | 8 | use Wallabag\CoreBundle\Repository; |
9 | use Wallabag\CoreBundle\Entity\Entries; | 9 | use Wallabag\CoreBundle\Entity\Entries; |
10 | use Wallabag\CoreBundle\Service\Extractor; | ||
10 | use Wallabag\Wallabag\Tools; | 11 | use Wallabag\Wallabag\Tools; |
11 | use Wallabag\Wallabag\Url; | 12 | use Wallabag\Wallabag\Url; |
12 | 13 | ||
@@ -32,10 +33,12 @@ class EntryController extends Controller | |||
32 | 33 | ||
33 | if ($form->isValid()) { | 34 | if ($form->isValid()) { |
34 | 35 | ||
35 | $content = Tools::getPageContent(new Url($entry->getUrl())); | 36 | $content = Extractor::extract($entry->getUrl()); |
36 | var_dump($content);die; | ||
37 | 37 | ||
38 | $em = $this->getDoctrine()->getEntityManager(); | 38 | $entry->setTitle($content->getTitle()); |
39 | $entry->setContent($content->getBody()); | ||
40 | |||
41 | $em = $this->getDoctrine()->getManager(); | ||
39 | $em->persist($entry); | 42 | $em->persist($entry); |
40 | $em->flush(); | 43 | $em->flush(); |
41 | 44 | ||
@@ -170,7 +173,7 @@ class EntryController extends Controller | |||
170 | */ | 173 | */ |
171 | public function deleteEntryAction(Request $request, Entries $entry) | 174 | public function deleteEntryAction(Request $request, Entries $entry) |
172 | { | 175 | { |
173 | $em = $this->getDoctrine()->getEntityManager(); | 176 | $em = $this->getDoctrine()->getManager(); |
174 | $em->remove($entry); | 177 | $em->remove($entry); |
175 | $em->flush(); | 178 | $em->flush(); |
176 | 179 | ||