Clearing entities in the loop fail on Postgres

It looks like when you clear entities on Postgres some references are lost and tags are not saved :-/
This commit is contained in:
Jeremy Benoist 2016-09-11 16:30:01 +02:00
parent 58fadbc9df
commit 88e88016b9
No known key found for this signature in database
GPG Key ID: BCA73962457ACC3C
3 changed files with 3 additions and 12 deletions

View File

@ -255,14 +255,11 @@ class PocketImport extends AbstractImport
// flush every 20 entries // flush every 20 entries
if (($i % 20) === 0) { if (($i % 20) === 0) {
$this->em->flush(); $this->em->flush();
// clear only affected entities
$this->em->clear(Entry::class);
$this->em->clear(Tag::class);
} }
++$i; ++$i;
} }
$this->em->flush(); $this->em->flush();
$this->em->clear();
} }
} }

View File

@ -169,14 +169,11 @@ class ReadabilityImport extends AbstractImport
// flush every 20 entries // flush every 20 entries
if (($i % 20) === 0) { if (($i % 20) === 0) {
$this->em->flush(); $this->em->flush();
// clear only affected entities
$this->em->clear(Entry::class);
$this->em->clear(Tag::class);
} }
++$i; ++$i;
} }
$this->em->flush(); $this->em->flush();
$this->em->clear();
} }
} }

View File

@ -172,15 +172,12 @@ abstract class WallabagImport extends AbstractImport
// flush every 20 entries // flush every 20 entries
if (($i % 20) === 0) { if (($i % 20) === 0) {
$this->em->flush(); $this->em->flush();
// clear only affected entities
$this->em->clear(Entry::class);
$this->em->clear(Tag::class);
} }
++$i; ++$i;
} }
$this->em->flush(); $this->em->flush();
$this->em->clear();
} }
/** /**