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:
parent
75c3478a0c
commit
558d9aabab
5 changed files with 156 additions and 19 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue