How to get a PhpStorm warning over Symfony dump()
I haven’t been blogging for a while. I was feeling like I was running out of material for my series of blog posts, which I was used to call “Distilled Domain-Driven Design”. The conclusion was a presentation at SymfonyCon Amsterdam, A love story staring Symfony and Domain-Driven Design.
Before moving to another topic, I wanted to share a quick tip. Sometimes, I forget a dump()
in my code, and will commit it. It will crash in “prod” (environment), so you want to avoid that. Here is how to configure PhpStorm to trigger a warning.
Decouple your Symfony application using Domain Events
In my previous post,
we saw a better way to represent model data with value objects and Doctrine embeddable.
But sometimes, you need to represent not data, but what happened. There, you need Domain Events.
They are a lesser known concept, but they will help you immensely to decouple your application. With those, you will be able to better isolate the domain logic.
Implementing them in a Symfony application, typically with Doctrine ORM, is challenging. Let’s see what are the options, and try to find the best way.
Stop repeating yourself in Doctrine and Symfony forms with Value objects
To continue my series on software architecture, I will go through different concepts and patterns popular in Domain-Driven Design.
We will see how they can be useful every day and in most projects.
The first concept is value object. Using those, you will get a better, more concise and more expressive, model. Practically, it helps you to avoid repeating yourself in your Doctrine entities, as some logic and some properties will be factorized.
Eventually, it could also help make your Symfony forms more readable. A common form type could replace some copy-pasted code.
CQRS, Symfony, ElasticSearch and React
Software architecture is an extremely interesting and useful topic. A lack of architecture and your code will turn into some spaghetti mess. But if you overuse it, your code will be over complicated and equally hard to work with. A few years ago I dived into the academic literature, and various online sources. This post is the first of a series about what I learnt and what I found useful in my past professional experience.
[more…]About Doctrine inheritance
At a previous SymfonyLive conference (slides here, in French), I advised not to use Doctrine inheritance mapping. After a discussion with another developer last week, I realized the subject is worth an article with more details.
[more…]Hello World
Welcome to my blog!
After blogging for a while on https://blog.netinfluence.ch, in French, I wanted to start writing in English too. Hence this blog! I will continue publishing articles on both, though. They will have different topics and approaches. Here, I will try to dig into more advanced Symfony topics.
[more…]