X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=src%2FWallabag%2FCoreBundle%2FHelper%2FContentProxy.php;h=bd8b993a1c56b1b73078a5f0e1666f65a26c7b93;hb=e008c037f53324b931f027483f9f1053171109c5;hp=7fb41393127c8bcdaab1a11511a988e93bb6cb16;hpb=da3d4998c0972557952c83b610f8f45fdcd31b72;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 7fb41393..bd8b993a 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -3,6 +3,7 @@ namespace Wallabag\CoreBundle\Helper; use Graby\Graby; +use Psr\Log\LoggerInterface as Logger; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Tools\Utils; @@ -13,10 +14,14 @@ use Wallabag\CoreBundle\Tools\Utils; class ContentProxy { protected $graby; + protected $tagger; + protected $logger; - public function __construct(Graby $graby) + public function __construct(Graby $graby, RuleBasedTagger $tagger, Logger $logger) { $this->graby = $graby; + $this->tagger = $tagger; + $this->logger = $logger; } /** @@ -59,6 +64,15 @@ class ContentProxy $entry->setPreviewPicture($content['open_graph']['og_image']); } + try { + $this->tagger->tag($entry); + } catch (\Exception $e) { + $this->logger->error('Error while trying to automatically tag an entry.', array( + 'entry_url' => $url, + 'error_msg' => $e->getMessage(), + )); + } + return $entry; } }