Guest User

Untitled

a guest
Jul 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2. require_once "bootstrap.php";
  3. $productRepository = $entityManager->getRepository('Product');
  4. $products = $productRepository->findAll();
  5. foreach ($products as $product) {
  6. echo '#' . $product->getId();
  7. echo ' ';
  8. echo $product->getName();
  9. echo ' (' . $product->getOwnerName() . ')';
  10. echo " - ". getMemoryUsage();
  11. echo "\n";
  12. }
  13. // with 400k rows this consumes a constant 646.01 MB
  14. // this is because doctrine loads all the results into the memory before we iterate on it.
Add Comment
Please, Sign In to add comment