Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- With the foreach commented out, the code runs without errors.
- If this line is uncommented:
- foreach ($sale->getInvoices() as $invoice) { }
- Then the code breaks with this error.
- Notice: Undefined index: 00000000583b34730000000060d36b73 in .../
- vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php on line 2053
- = = = = = = = = = = = = = = = = =
- public function indexAction()
- {
- $em = $this->get('doctrine.orm.entity_manager');
- $q = $em->createQuery("select s from CoreBundle:Sale s");
- $results = $q->getResult();
- $count = 0;
- foreach ($results as $sale) {
- $sale->setValue(rand());
- // FOREACH COMMENTED OUT
- // foreach ($sale->getInvoices() as $invoice) { }
- if (0 == $count++%50) {
- $em->flush();
- $em->clear();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement