]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ImportBundle/Import/WallabagV1Import.php
Mark all imported articles as read
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Import / WallabagV1Import.php
index 05bdb4014239bc1535619e0aa1f76fd016ce11aa..1d773d3bb58e2094ac057c490121c5dc9883479d 100644 (file)
@@ -19,6 +19,7 @@ class WallabagV1Import implements ImportInterface
     protected $skippedEntries = 0;
     protected $importedEntries = 0;
     protected $filepath;
+    protected $markAsRead;
 
     public function __construct(EntityManager $em, ContentProxy $contentProxy)
     {
@@ -120,6 +121,18 @@ class WallabagV1Import implements ImportInterface
         return $this;
     }
 
+    /**
+     * Set whether articles must be all marked as read.
+     *
+     * @param bool $markAsRead
+     */
+    public function setMarkAsRead($markAsRead)
+    {
+        $this->markAsRead = $markAsRead;
+
+        return $this;
+    }
+
     /**
      * @param $entries
      */
@@ -160,7 +173,7 @@ class WallabagV1Import implements ImportInterface
                 );
             }
 
-            $entry->setArchived($importedEntry['is_read']);
+            $entry->setArchived($importedEntry['is_read'] || $this->markAsRead);
             $entry->setStarred($importedEntry['is_fav']);
 
             $this->em->persist($entry);