Skip to content

Commit

Permalink
Ability to customize the clear method
Browse files Browse the repository at this point in the history
  • Loading branch information
Baachi committed Mar 26, 2015
1 parent 57c19a2 commit 20e44dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Ddeboer/DataImport/Writer/DoctrineWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ public function writeItem(array $item)
$this->entityManager->persist($entity);

if (($this->counter % $this->batchSize) == 0) {
$this->entityManager->flush();
$this->entityManager->clear($this->entityName);
$this->flushAndClear();
}

return $this;
Expand Down Expand Up @@ -318,4 +317,10 @@ protected function findOrCreateItem(array $item)

return $entity;
}

protected function flushAndClear()
{
$this->entityManager->flush();
$this->entityManager->clear($this->entityName);
}
}

0 comments on commit 20e44dd

Please sign in to comment.