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.
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.
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…]
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…]
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…]