3 namespace Wallabag\ImportBundle\Import
;
5 use Psr\Log\LoggerInterface
;
6 use Psr\Log\NullLogger
;
7 use Doctrine\ORM\EntityManager
;
8 use Wallabag\CoreBundle\Helper\ContentProxy
;
9 use Wallabag\CoreBundle\Entity\Entry
;
11 abstract class AbstractImport
implements ImportInterface
15 protected $contentProxy;
17 public function __construct(EntityManager
$em, ContentProxy
$contentProxy)
20 $this->logger
= new NullLogger();
21 $this->contentProxy
= $contentProxy;
24 public function setLogger(LoggerInterface
$logger)
26 $this->logger
= $logger;
30 * Fetch content from the ContentProxy (using graby).
31 * If it fails return false instead of the updated entry.
33 * @param Entry $entry Entry to update
34 * @param string $url Url to grab content for
35 * @param array $content An array with AT LEAST keys title, html, url, language & content_type to skip the fetchContent from the url
39 protected function fetchContent(Entry
$entry, $url, array $content = [])
42 return $this->contentProxy
->updateEntry($entry, $url, $content);
43 } catch (\Exception
$e) {