diff options
Diffstat (limited to 'src/Wallabag/ImportBundle')
6 files changed, 16 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; | |||
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | 8 | use Wallabag\CoreBundle\Helper\ContentProxy; |
9 | use Wallabag\CoreBundle\Entity\Entry; | 9 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Wallabag\CoreBundle\Entity\Tag; | 10 | use Wallabag\CoreBundle\Entity\Tag; |
11 | use Wallabag\CoreBundle\Helper\TagsAssigner; | ||
11 | use Wallabag\UserBundle\Entity\User; | 12 | use Wallabag\UserBundle\Entity\User; |
12 | use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface; | 13 | use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface; |
13 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; | 14 | use 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 | ||
5 | use Wallabag\CoreBundle\Entity\Entry; | 5 | use Wallabag\CoreBundle\Entity\Entry; |
6 | use Wallabag\UserBundle\Entity\User; | 6 | use Wallabag\UserBundle\Entity\User; |
7 | use Wallabag\CoreBundle\Helper\ContentProxy; | ||
8 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | 7 | use Wallabag\CoreBundle\Event\EntrySavedEvent; |
9 | 8 | ||
10 | abstract class BrowserImport extends AbstractImport | 9 | abstract 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; | |||
5 | use GuzzleHttp\Client; | 5 | use GuzzleHttp\Client; |
6 | use GuzzleHttp\Exception\RequestException; | 6 | use GuzzleHttp\Exception\RequestException; |
7 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | ||
9 | 8 | ||
10 | class PocketImport extends AbstractImport | 9 | class 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() |
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" ]] |