Skip to content

Commit

Permalink
Merge pull request #576 from acasademont/patch-1
Browse files Browse the repository at this point in the history
Update docs/en/reference/batch-processing.rst
  • Loading branch information
beberlei committed Feb 11, 2013
2 parents e86419c + 4c90d0c commit d08c010
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/en/reference/batch-processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internally but also mean more work during ``flush``.
$user->setUsername('user' . $i);
$user->setName('Mr.Smith-' . $i);
$em->persist($user);
if (($i % $batchSize) == 0) {
if (($i % $batchSize) === 0) {
$em->flush();
$em->clear(); // Detaches all objects from Doctrine!
}
Expand Down Expand Up @@ -80,12 +80,13 @@ with the batching strategy that was already used for bulk inserts:
$user = $row[0];
$user->increaseCredit();
$user->calculateNewBonuses();
if (($i % $batchSize) == 0) {
if (($i % $batchSize) === 0) {
$em->flush(); // Executes all updates.
$em->clear(); // Detaches all objects from Doctrine!
}
++$i;
}
$em->flush();
.. note::

Expand Down Expand Up @@ -132,12 +133,13 @@ The following example shows how to do this:
$iterableResult = $q->iterate();
while (($row = $iterableResult->next()) !== false) {
$em->remove($row[0]);
if (($i % $batchSize) == 0) {
if (($i % $batchSize) === 0) {
$em->flush(); // Executes all deletions.
$em->clear(); // Detaches all objects from Doctrine!
}
++$i;
}
$em->flush();
.. note::

Expand Down

0 comments on commit d08c010

Please sign in to comment.