1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-22 17:18:37 +00:00

Move fetching content in a separate class

This commit is contained in:
Jeremy Benoist 2015-09-10 21:57:25 +02:00
parent 75c3478a0c
commit 558d9aabab
5 changed files with 156 additions and 19 deletions

View file

@ -30,15 +30,7 @@ class EntryController extends Controller
$form->handleRequest($request);
if ($form->isValid()) {
$content = $this->get('wallabag_core.graby')->fetchContent($entry->getUrl());
$entry->setUrl($content['url'] ?: $entry->getUrl());
$entry->setTitle($content['title']);
$entry->setContent($content['html']);
$entry->setMimetype($content['content_type']);
if (isset($content['open_graph']['og_image'])) {
$entry->setPreviewPicture($content['open_graph']['og_image']);
}
$entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
$em = $this->getDoctrine()->getManager();
$em->persist($entry);