mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-17 17:08:37 +00:00
refactoring for fetching content
This commit is contained in:
parent
ad4d1caa9e
commit
6b767d1cc0
6 changed files with 135 additions and 12 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue