diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-25 11:26:15 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-09-25 12:03:49 +0200 |
commit | 401135852c6b25c8d5ab97beaefb02d1bd023ec9 (patch) | |
tree | 5922f4bd40af0ceb61db2c55755bc006f18410fb /src/Wallabag/ImportBundle | |
parent | faa86e06ba3032fdb98f3c0f79c72e8581d3c96f (diff) | |
download | wallabag-401135852c6b25c8d5ab97beaefb02d1bd023ec9.tar.gz wallabag-401135852c6b25c8d5ab97beaefb02d1bd023ec9.tar.zst wallabag-401135852c6b25c8d5ab97beaefb02d1bd023ec9.zip |
Use scheduled entity insertions to avoid tag duplicate
Using `getScheduledEntityInsertions()` we can retrieve not yet flushed but already persisted entities and then avoid tags duplication on import.
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/PocketImport.php | 3 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/Import/WallabagImport.php | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index e00eb44b..327e2500 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php | |||
@@ -227,7 +227,8 @@ class PocketImport extends AbstractImport | |||
227 | if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) { | 227 | if (isset($importedEntry['tags']) && !empty($importedEntry['tags'])) { |
228 | $this->contentProxy->assignTagsToEntry( | 228 | $this->contentProxy->assignTagsToEntry( |
229 | $entry, | 229 | $entry, |
230 | array_keys($importedEntry['tags']) | 230 | array_keys($importedEntry['tags']), |
231 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() | ||
231 | ); | 232 | ); |
232 | } | 233 | } |
233 | 234 | ||
diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php index 043bb0a2..3754e4a9 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagImport.php +++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php | |||
@@ -111,7 +111,8 @@ abstract class WallabagImport extends AbstractImport | |||
111 | if (array_key_exists('tags', $data)) { | 111 | if (array_key_exists('tags', $data)) { |
112 | $this->contentProxy->assignTagsToEntry( | 112 | $this->contentProxy->assignTagsToEntry( |
113 | $entry, | 113 | $entry, |
114 | $data['tags'] | 114 | $data['tags'], |
115 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() | ||
115 | ); | 116 | ); |
116 | } | 117 | } |
117 | 118 | ||