aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r--src/Wallabag/ImportBundle/Import/AbstractImport.php5
-rw-r--r--src/Wallabag/ImportBundle/Import/BrowserImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/PinboardImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Resources/config/services.yml8
6 files changed, 16 insertions, 5 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..c8a9b4e6 100644
--- a/src/Wallabag/ImportBundle/Import/BrowserImport.php
+++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php
@@ -205,7 +205,7 @@ abstract class BrowserImport extends AbstractImport
205 $entry = $this->fetchContent($entry, $data['url'], $data); 205 $entry = $this->fetchContent($entry, $data['url'], $data);
206 206
207 if (array_key_exists('tags', $data)) { 207 if (array_key_exists('tags', $data)) {
208 $this->contentProxy->assignTagsToEntry( 208 $this->tagsAssigner->assignTagsToEntry(
209 $entry, 209 $entry,
210 $data['tags'] 210 $data['tags']
211 ); 211 );
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..1171d452 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -216,7 +216,7 @@ class PocketImport extends AbstractImport
216 } 216 }
217 217
218 if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) { 218 if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) {
219 $this->contentProxy->assignTagsToEntry( 219 $this->tagsAssigner->assignTagsToEntry(
220 $entry, 220 $entry,
221 array_keys($importedEntry['tags']), 221 array_keys($importedEntry['tags']),
222 $this->em->getUnitOfWork()->getScheduledEntityInsertions() 222 $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()
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml
index c4fe3f92..661dc7e1 100644
--- a/src/Wallabag/ImportBundle/Resources/config/services.yml
+++ b/src/Wallabag/ImportBundle/Resources/config/services.yml
@@ -20,6 +20,7 @@ services:
20 arguments: 20 arguments:
21 - "@doctrine.orm.entity_manager" 21 - "@doctrine.orm.entity_manager"
22 - "@wallabag_core.content_proxy" 22 - "@wallabag_core.content_proxy"
23 - "@wallabag_core.tags_assigner"
23 - "@event_dispatcher" 24 - "@event_dispatcher"
24 calls: 25 calls:
25 - [ setClient, [ "@wallabag_import.pocket.client" ] ] 26 - [ setClient, [ "@wallabag_import.pocket.client" ] ]
@@ -32,6 +33,7 @@ services:
32 arguments: 33 arguments:
33 - "@doctrine.orm.entity_manager" 34 - "@doctrine.orm.entity_manager"
34 - "@wallabag_core.content_proxy" 35 - "@wallabag_core.content_proxy"
36 - "@wallabag_core.tags_assigner"
35 - "@event_dispatcher" 37 - "@event_dispatcher"
36 calls: 38 calls:
37 - [ setLogger, [ "@logger" ]] 39 - [ setLogger, [ "@logger" ]]
@@ -43,6 +45,7 @@ services:
43 arguments: 45 arguments:
44 - "@doctrine.orm.entity_manager" 46 - "@doctrine.orm.entity_manager"
45 - "@wallabag_core.content_proxy" 47 - "@wallabag_core.content_proxy"
48 - "@wallabag_core.tags_assigner"
46 - "@event_dispatcher" 49 - "@event_dispatcher"
47 calls: 50 calls:
48 - [ setLogger, [ "@logger" ]] 51 - [ setLogger, [ "@logger" ]]
@@ -54,6 +57,7 @@ services:
54 arguments: 57 arguments:
55 - "@doctrine.orm.entity_manager" 58 - "@doctrine.orm.entity_manager"
56 - "@wallabag_core.content_proxy" 59 - "@wallabag_core.content_proxy"
60 - "@wallabag_core.tags_assigner"
57 - "@event_dispatcher" 61 - "@event_dispatcher"
58 calls: 62 calls:
59 - [ setLogger, [ "@logger" ]] 63 - [ setLogger, [ "@logger" ]]
@@ -65,6 +69,7 @@ services:
65 arguments: 69 arguments:
66 - "@doctrine.orm.entity_manager" 70 - "@doctrine.orm.entity_manager"
67 - "@wallabag_core.content_proxy" 71 - "@wallabag_core.content_proxy"
72 - "@wallabag_core.tags_assigner"
68 - "@event_dispatcher" 73 - "@event_dispatcher"
69 calls: 74 calls:
70 - [ setLogger, [ "@logger" ]] 75 - [ setLogger, [ "@logger" ]]
@@ -76,6 +81,7 @@ services:
76 arguments: 81 arguments:
77 - "@doctrine.orm.entity_manager" 82 - "@doctrine.orm.entity_manager"
78 - "@wallabag_core.content_proxy" 83 - "@wallabag_core.content_proxy"
84 - "@wallabag_core.tags_assigner"
79 - "@event_dispatcher" 85 - "@event_dispatcher"
80 calls: 86 calls:
81 - [ setLogger, [ "@logger" ]] 87 - [ setLogger, [ "@logger" ]]
@@ -87,6 +93,7 @@ services:
87 arguments: 93 arguments:
88 - "@doctrine.orm.entity_manager" 94 - "@doctrine.orm.entity_manager"
89 - "@wallabag_core.content_proxy" 95 - "@wallabag_core.content_proxy"
96 - "@wallabag_core.tags_assigner"
90 - "@event_dispatcher" 97 - "@event_dispatcher"
91 calls: 98 calls:
92 - [ setLogger, [ "@logger" ]] 99 - [ setLogger, [ "@logger" ]]
@@ -97,6 +104,7 @@ services:
97 arguments: 104 arguments:
98 - "@doctrine.orm.entity_manager" 105 - "@doctrine.orm.entity_manager"
99 - "@wallabag_core.content_proxy" 106 - "@wallabag_core.content_proxy"
107 - "@wallabag_core.tags_assigner"
100 - "@event_dispatcher" 108 - "@event_dispatcher"
101 calls: 109 calls:
102 - [ setLogger, [ "@logger" ]] 110 - [ setLogger, [ "@logger" ]]