GraphQL in Magento 2 – custom resolver, schema, authorization, testing in DDEV
Magento 2.3 introduced GraphQL as an alternative to the REST API. Where REST requires separate endpoints for each resource, GraphQL lets the client decide what data it needs in a single query. I show how to write a custom resolver and expose data through GraphQL in a Magento 2 module.
- Published in Magento / Adobe Commerce
PHP 7.4 in practice – typed properties pitfalls, hydration, PHP 8.0 preview
PHP 7.4 was released in November 2019. After migrating several Magento 2 modules to the new version I have a clear picture. Typed properties genuinely affect the way you write classes – but they also have pitfalls worth knowing. I show what works great, what surprises you, and what migration looks like in practice.
- Published in PHP
Factory Method – Simple Factory, GoF, auto-generated factories in Magento 2
The new operator in production code is a warning sign. A class that directly instantiates other classes is tightly coupled to them – hard to test, hard to extend. Factory Method delegates the responsibility for object creation to dedicated classes. In Magento 2 factories are everywhere – and generated automatically.
- Published in Wzorce projektowe
Message Queue Framework with RabbitMQ – publisher, consumer, DDEV config
Operations like sending emails, syncing with an ERP, or recalculating indexes do not have to block an HTTP request. Magento 2 has a built-in Message Queue Framework that lets you push such tasks to an asynchronous queue. I show how it works with RabbitMQ and how to write your own publisher and consumer.
- Published in Magento / Adobe Commerce
