forked from wallabag/wallabag
Move Tags assigner to a separate file
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@ -8,6 +8,7 @@ use Doctrine\ORM\EntityManager;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
use Wallabag\CoreBundle\Helper\TagsAssigner;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
@ -18,6 +19,7 @@ abstract class AbstractImport implements ImportInterface
|
||||
protected $em;
|
||||
protected $logger;
|
||||
protected $contentProxy;
|
||||
protected $tagsAssigner;
|
||||
protected $eventDispatcher;
|
||||
protected $producer;
|
||||
protected $user;
|
||||
@ -26,11 +28,12 @@ abstract class AbstractImport implements ImportInterface
|
||||
protected $importedEntries = 0;
|
||||
protected $queuedEntries = 0;
|
||||
|
||||
public function __construct(EntityManager $em, ContentProxy $contentProxy, EventDispatcherInterface $eventDispatcher)
|
||||
public function __construct(EntityManager $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->logger = new NullLogger();
|
||||
$this->contentProxy = $contentProxy;
|
||||
$this->tagsAssigner = $tagsAssigner;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ abstract class BrowserImport extends AbstractImport
|
||||
$entry = $this->fetchContent($entry, $data['url'], $data);
|
||||
|
||||
if (array_key_exists('tags', $data)) {
|
||||
$this->contentProxy->assignTagsToEntry(
|
||||
$this->tagsAssigner->assignTagsToEntry(
|
||||
$entry,
|
||||
$data['tags']
|
||||
);
|
||||
|
||||
@ -112,7 +112,7 @@ class PinboardImport extends AbstractImport
|
||||
$entry = $this->fetchContent($entry, $data['url'], $data);
|
||||
|
||||
if (!empty($data['tags'])) {
|
||||
$this->contentProxy->assignTagsToEntry(
|
||||
$this->tagsAssigner->assignTagsToEntry(
|
||||
$entry,
|
||||
$data['tags'],
|
||||
$this->em->getUnitOfWork()->getScheduledEntityInsertions()
|
||||
|
||||
@ -216,7 +216,7 @@ class PocketImport extends AbstractImport
|
||||
}
|
||||
|
||||
if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) {
|
||||
$this->contentProxy->assignTagsToEntry(
|
||||
$this->tagsAssigner->assignTagsToEntry(
|
||||
$entry,
|
||||
array_keys($importedEntry['tags']),
|
||||
$this->em->getUnitOfWork()->getScheduledEntityInsertions()
|
||||
|
||||
@ -111,7 +111,7 @@ abstract class WallabagImport extends AbstractImport
|
||||
$entry = $this->fetchContent($entry, $data['url'], $data);
|
||||
|
||||
if (array_key_exists('tags', $data)) {
|
||||
$this->contentProxy->assignTagsToEntry(
|
||||
$this->tagsAssigner->assignTagsToEntry(
|
||||
$entry,
|
||||
$data['tags'],
|
||||
$this->em->getUnitOfWork()->getScheduledEntityInsertions()
|
||||
|
||||
Reference in New Issue
Block a user