]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Clearing entities in the loop fail on Postgres 2279/head
authorJeremy Benoist <jeremy.benoist@gmail.com>
Sun, 11 Sep 2016 14:30:01 +0000 (16:30 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sun, 11 Sep 2016 14:30:01 +0000 (16:30 +0200)
It looks like when you clear entities on Postgres some references are lost and tags are not saved :-/

src/Wallabag/ImportBundle/Import/PocketImport.php
src/Wallabag/ImportBundle/Import/ReadabilityImport.php
src/Wallabag/ImportBundle/Import/WallabagImport.php

index 841f829d07614cf1e3adc7b9f3d457cce56b2bbd..a6f905b145533edf1f692f2dadcc36db3c09b0d7 100644 (file)
@@ -255,14 +255,11 @@ class PocketImport extends AbstractImport
             // flush every 20 entries
             if (($i % 20) === 0) {
                 $this->em->flush();
-
-                // clear only affected entities
-                $this->em->clear(Entry::class);
-                $this->em->clear(Tag::class);
             }
             ++$i;
         }
 
         $this->em->flush();
+        $this->em->clear();
     }
 }
index 7bae647d751967badc971fd7a90d5c5dfb4612da..c7cfe15d91f5c6f62e7f3a766c555fe979518096 100644 (file)
@@ -169,14 +169,11 @@ class ReadabilityImport extends AbstractImport
             // flush every 20 entries
             if (($i % 20) === 0) {
                 $this->em->flush();
-
-                // clear only affected entities
-                $this->em->clear(Entry::class);
-                $this->em->clear(Tag::class);
             }
             ++$i;
         }
 
         $this->em->flush();
+        $this->em->clear();
     }
 }
index 9cd3dcb8bac7213118136503d64a799016de6cbb..581ec178f82e19ae530550568d9edf4f010ccab0 100644 (file)
@@ -172,15 +172,12 @@ abstract class WallabagImport extends AbstractImport
             // flush every 20 entries
             if (($i % 20) === 0) {
                 $this->em->flush();
-
-                // clear only affected entities
-                $this->em->clear(Entry::class);
-                $this->em->clear(Tag::class);
             }
             ++$i;
         }
 
         $this->em->flush();
+        $this->em->clear();
     }
 
     /**