Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
77<br />
Bulk Inserts with Domain<br />
• Insert 10000 objects batches of 20:<br />
$batchSize = 20;<br />
for ($i = 1; $i setStatus('user');<br />
$user->setUsername('user' . $i);<br />
$user->setName('Mr.Smith-' . $i);<br />
$em->persist($user);<br />
if ($i % $batchSize == 0) {<br />
$em->flush();<br />
$em->clear(); // Detaches all objects from <strong>Doctrine</strong>!<br />
}<br />
}<br />
<strong>Zend</strong> <strong>Framework</strong> 1 + <strong>Doctrine</strong> 2