]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ImportBundle/Import/WallabagImport.php
Merge remote-tracking branch 'origin/master' into 2.3
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Import / WallabagImport.php
index 8e50b135a980a522feda860773671339250a35ad..c64ccd64d196095ce8b9e3f913c4f856075f0fa3 100644 (file)
@@ -58,6 +58,8 @@ abstract class WallabagImport extends AbstractImport
         $data = json_decode(file_get_contents($this->filepath), true);
 
         if (empty($data)) {
+            $this->logger->error('WallabagImport: no entries in imported file');
+
             return false;
         }
 
@@ -72,17 +74,6 @@ abstract class WallabagImport extends AbstractImport
         return true;
     }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function getSummary()
-    {
-        return [
-            'skipped' => $this->skippedEntries,
-            'imported' => $this->importedEntries,
-        ];
-    }
-
     /**
      * Set file path to the json file.
      *
@@ -112,23 +103,18 @@ abstract class WallabagImport extends AbstractImport
 
         $data = $this->prepareEntry($importedEntry);
 
-        $entry = $this->fetchContent(
-            new Entry($this->user),
-            $importedEntry['url'],
-            $data
-        );
-
-        // jump to next entry in case of problem while getting content
-        if (false === $entry) {
-            ++$this->skippedEntries;
+        $entry = new Entry($this->user);
+        $entry->setUrl($data['url']);
+        $entry->setTitle($data['title']);
 
-            return;
-        }
+        // update entry with content (in case fetching failed, the given entry will be return)
+        $this->fetchContent($entry, $data['url'], $data);
 
         if (array_key_exists('tags', $data)) {
-            $this->contentProxy->assignTagsToEntry(
+            $this->tagsAssigner->assignTagsToEntry(
                 $entry,
-                $data['tags']
+                $data['tags'],
+                $this->em->getUnitOfWork()->getScheduledEntityInsertions()
             );
         }