Javel's notes

TIL; Symfony messenger handle trait

When using Symfony messenger bus synchronously, it's now trivial to get the result returned by command handlers, thanks to the HandlerTrait provided by the messenger bundle.

Sources

* * *

TIL; clip-path

clip-path CSS property can be used to change the shape an HTML element, using function such as polygon, circle, to determine which part of the element should be masked and which part should be shown.

Extremely handy to create beveled shapes.

Sources

* * *

TIL; array_filter without callback

Use array_filter without callback to remove every empty item from an array.

Sources

* * *

TIL; aspect ratio

A modern way to maintain a consistent width-to-height ratio, available from chrome 88, firefox 87 & safari 118.

Sources

* * *

TIL; Symfony messenger & doctrine_transaction

Symfony messenger can be configured to use the doctrine_transaction middleware in order to encapsulate all SQL queries performed within command handlers in a single transaction.

As a main consequence, it's no longer necessary to call flush from each handlers, as it will now be performed by the middleware. Dependency injection is therefore lightened, as we don't need to inject the entity manager anymore for that usage.

Sources

© Joris Langlois 2023