Contents
- 1. GoF Iterator Pattern: the interface
- 2. PHP Iterator interface and IteratorAggregate
- 3. Varien_Data_Collection: the foundation
- 4. Magento AbstractCollection and lazy loading
- 5. Collection filters, joins and pagination
- 6. Chunked iterator: large catalogs without memory overflow
- 7. PHP generators as lazy iterators
- 8. Building a custom iterator for Magento
- 9. Iterator vs. getItems(): performance comparison
- 10. Conclusion: using collections correctly
The Iterator Pattern is one of the most commonly used GoF patterns in Magento, you use it every day whenever you iterate over a collection. foreach ($productCollection as $product) is the Iterator