-1

If I try to iterate trough a QueryResult with a lot of relations, my foreach loop needs a lot of time.

    /** @var Product $productItem */
    foreach ($products as $productItem) {
        print($productItem->getTitle());
    }

How can I do it the fast way?

Thanks in advance

Jonas
  • 349
  • 3
  • 21

1 Answers1

1

You can annotate relations in every model with @lazy which will save you alot of time. After adding @lazy annoation you have to clear the cache in the install tool or reinstall the extension to take effect.

Paul Beck
  • 2,675
  • 1
  • 12
  • 14