Iterator and Generator – lazy processing, yield, IteratorAggregate, memory benchmark
Iterator and Generator are two related but distinct mechanisms in PHP. Iterator is a GoF pattern that gives sequential access to a collection without exposing its internal structure. Generator is a PHP language feature that creates an Iterator using yield – without storing all values in memory at once. I show both, benchmark the memory difference, and apply them to large-scale Magento product processing.
- Published in Wzorce projektowe
Extension Attributes – full implementation with batch loading, REST API, unit tests
Extension Attributes are Magento 2’s mechanism for extending existing entities (Product, Order, Customer) without modifying core tables. They participate in the REST API automatically and can carry any data type. Most tutorials show a simple string attribute. I show a complete implementation with batch loading (fixing N+1), REST API exposure with serialisation, and unit tests.
- Published in Magento / Adobe Commerce
PHP 8.5 RC1 – pipe operator in real code, pitfalls, readonly inheritance confirmed
PHP 8.5 RC1 is out and the pipe operator is in it. After weeks with real Magento 2 module code using the RC, I can report what the pipe operator is genuinely good for, where it creates surprises, and confirm that readonly property inheritance works exactly as the RFC described. This is practical experience, not theory.
- Published in PHP
DDEV advanced – mutagen, custom services, hooks, shared team configuration
DDEV out of the box is fast to set up but the defaults leave performance on the table. Mutagen file sync, custom services, project hooks, and shared team configuration in version control reduce friction for everyone on the project. I show the advanced DDEV setup I use on large Magento 2 projects with multiple developers.
- Published in Środowiska
