aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-05 07:50:10 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-11 21:58:55 +0200
commit3849a9f3231c0109c87af085452c3ac5e4aed303 (patch)
treed5b8946a196f98aa438e7a39568b40af4952712e /src/Wallabag/ImportBundle/Import/ReadabilityImport.php
parent02f64895728fe9aee2c696a627e0bbe27a24faf2 (diff)
downloadwallabag-3849a9f3231c0109c87af085452c3ac5e4aed303.tar.gz
wallabag-3849a9f3231c0109c87af085452c3ac5e4aed303.tar.zst
wallabag-3849a9f3231c0109c87af085452c3ac5e4aed303.zip
Some cleanup & refactor
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/ReadabilityImport.php')
-rw-r--r--src/Wallabag/ImportBundle/Import/ReadabilityImport.php28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
index 18a6631a..64ef62bf 100644
--- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
+++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
@@ -3,7 +3,6 @@
3namespace Wallabag\ImportBundle\Import; 3namespace Wallabag\ImportBundle\Import;
4 4
5use Wallabag\CoreBundle\Entity\Entry; 5use Wallabag\CoreBundle\Entity\Entry;
6use Wallabag\UserBundle\Entity\User;
7 6
8class ReadabilityImport extends AbstractImport 7class ReadabilityImport extends AbstractImport
9{ 8{
@@ -136,31 +135,12 @@ class ReadabilityImport extends AbstractImport
136 } 135 }
137 136
138 /** 137 /**
139 * Faster parse entries for Producer. 138 * {@inheritdoc}
140 * We don't care to make check at this time. They'll be done by the consumer.
141 *
142 * @param array $entries
143 */ 139 */
144 protected function parseEntriesForProducer($entries) 140 protected function setEntryAsRead(array $importedEntry)
145 { 141 {
146 foreach ($entries as $importedEntry) { 142 $importedEntry['archive'] = 1;
147 // set userId for the producer (it won't know which user is connected)
148 $importedEntry['userId'] = $this->user->getId();
149
150 if ($this->markAsRead) {
151 $importedEntry['archive'] = 1;
152 }
153
154 ++$this->importedEntries;
155
156 // flush every 20 entries
157 if (($i % 20) === 0) {
158 $this->em->flush();
159 }
160 ++$i;
161 }
162 143
163 $this->em->flush(); 144 return $importedEntry;
164 $this->em->clear();
165 } 145 }
166} 146}