aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Import
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ImportBundle/Import')
-rw-r--r--src/Wallabag/ImportBundle/Import/AbstractImport.php5
-rw-r--r--src/Wallabag/ImportBundle/Import/BrowserImport.php3
-rw-r--r--src/Wallabag/ImportBundle/Import/PinboardImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php3
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagImport.php2
5 files changed, 8 insertions, 7 deletions
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php
index 1d4a6e27..a61388c0 100644
--- a/src/Wallabag/ImportBundle/Import/AbstractImport.php
+++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php
@@ -8,6 +8,7 @@ use Doctrine\ORM\EntityManager;
8use Wallabag\CoreBundle\Helper\ContentProxy; 8use Wallabag\CoreBundle\Helper\ContentProxy;
9use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\CoreBundle\Entity\Tag; 10use Wallabag\CoreBundle\Entity\Tag;
11use Wallabag\CoreBundle\Helper\TagsAssigner;
11use Wallabag\UserBundle\Entity\User; 12use Wallabag\UserBundle\Entity\User;
12use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface; 13use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface;
13use Symfony\Component\EventDispatcher\EventDispatcherInterface; 14use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -18,6 +19,7 @@ abstract class AbstractImport implements ImportInterface
18 protected $em; 19 protected $em;
19 protected $logger; 20 protected $logger;
20 protected $contentProxy; 21 protected $contentProxy;
22 protected $tagsAssigner;
21 protected $eventDispatcher; 23 protected $eventDispatcher;
22 protected $producer; 24 protected $producer;
23 protected $user; 25 protected $user;
@@ -26,11 +28,12 @@ abstract class AbstractImport implements ImportInterface
26 protected $importedEntries = 0; 28 protected $importedEntries = 0;
27 protected $queuedEntries = 0; 29 protected $queuedEntries = 0;
28 30
29 public function __construct(EntityManager $em, ContentProxy $contentProxy, EventDispatcherInterface $eventDispatcher) 31 public function __construct(EntityManager $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher)
30 { 32 {
31 $this->em = $em; 33 $this->em = $em;
32 $this->logger = new NullLogger(); 34 $this->logger = new NullLogger();
33 $this->contentProxy = $contentProxy; 35 $this->contentProxy = $contentProxy;
36 $this->tagsAssigner = $tagsAssigner;
34 $this->eventDispatcher = $eventDispatcher; 37 $this->eventDispatcher = $eventDispatcher;
35 } 38 }
36 39
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php
index 8bf7d92e..ef0eeb7e 100644
--- a/src/Wallabag/ImportBundle/Import/BrowserImport.php
+++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php
@@ -4,7 +4,6 @@ namespace Wallabag\ImportBundle\Import;
4 4
5use Wallabag\CoreBundle\Entity\Entry; 5use Wallabag\CoreBundle\Entity\Entry;
6use Wallabag\UserBundle\Entity\User; 6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Helper\ContentProxy;
8use Wallabag\CoreBundle\Event\EntrySavedEvent; 7use Wallabag\CoreBundle\Event\EntrySavedEvent;
9 8
10abstract class BrowserImport extends AbstractImport 9abstract class BrowserImport extends AbstractImport
@@ -205,7 +204,7 @@ abstract class BrowserImport extends AbstractImport
205 $entry = $this->fetchContent($entry, $data['url'], $data); 204 $entry = $this->fetchContent($entry, $data['url'], $data);
206 205
207 if (array_key_exists('tags', $data)) { 206 if (array_key_exists('tags', $data)) {
208 $this->contentProxy->assignTagsToEntry( 207 $this->tagsAssigner->assignTagsToEntry(
209 $entry, 208 $entry,
210 $data['tags'] 209 $data['tags']
211 ); 210 );
diff --git a/src/Wallabag/ImportBundle/Import/PinboardImport.php b/src/Wallabag/ImportBundle/Import/PinboardImport.php
index d9865534..489b9257 100644
--- a/src/Wallabag/ImportBundle/Import/PinboardImport.php
+++ b/src/Wallabag/ImportBundle/Import/PinboardImport.php
@@ -112,7 +112,7 @@ class PinboardImport extends AbstractImport
112 $entry = $this->fetchContent($entry, $data['url'], $data); 112 $entry = $this->fetchContent($entry, $data['url'], $data);
113 113
114 if (!empty($data['tags'])) { 114 if (!empty($data['tags'])) {
115 $this->contentProxy->assignTagsToEntry( 115 $this->tagsAssigner->assignTagsToEntry(
116 $entry, 116 $entry,
117 $data['tags'], 117 $data['tags'],
118 $this->em->getUnitOfWork()->getScheduledEntityInsertions() 118 $this->em->getUnitOfWork()->getScheduledEntityInsertions()
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 33093480..8835161b 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -5,7 +5,6 @@ namespace Wallabag\ImportBundle\Import;
5use GuzzleHttp\Client; 5use GuzzleHttp\Client;
6use GuzzleHttp\Exception\RequestException; 6use GuzzleHttp\Exception\RequestException;
7use Wallabag\CoreBundle\Entity\Entry; 7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\CoreBundle\Helper\ContentProxy;
9 8
10class PocketImport extends AbstractImport 9class PocketImport extends AbstractImport
11{ 10{
@@ -216,7 +215,7 @@ class PocketImport extends AbstractImport
216 } 215 }
217 216
218 if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) { 217 if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) {
219 $this->contentProxy->assignTagsToEntry( 218 $this->tagsAssigner->assignTagsToEntry(
220 $entry, 219 $entry,
221 array_keys($importedEntry['tags']), 220 array_keys($importedEntry['tags']),
222 $this->em->getUnitOfWork()->getScheduledEntityInsertions() 221 $this->em->getUnitOfWork()->getScheduledEntityInsertions()
diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php
index 702da057..0e5382cf 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagImport.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php
@@ -111,7 +111,7 @@ abstract class WallabagImport extends AbstractImport
111 $entry = $this->fetchContent($entry, $data['url'], $data); 111 $entry = $this->fetchContent($entry, $data['url'], $data);
112 112
113 if (array_key_exists('tags', $data)) { 113 if (array_key_exists('tags', $data)) {
114 $this->contentProxy->assignTagsToEntry( 114 $this->tagsAssigner->assignTagsToEntry(
115 $entry, 115 $entry,
116 $data['tags'], 116 $data['tags'],
117 $this->em->getUnitOfWork()->getScheduledEntityInsertions() 117 $this->em->getUnitOfWork()->getScheduledEntityInsertions()