Choosing between creating a Model or entity
The common mistake among some Symfony developers is that they think an entity is a Model or, even worse, it can be modified to look like a Model. I have seen entities that consist of a bunch of traits and services are injected into some of them. The end result is bulky code, which is hard to maintain and very slow to run.
Adding extra features to an entity is a bad practice. Keep entities as a data-persistence layer and, if you need a Model, create one. There, you can inject the services if you have to.
You might notice some third-party bundles such as FOSUserBundle
have another folder called Model
and keep objects similar to entities here. They also have extra code, usually called managers, to take care of additional needs and injecting other services.
As a general rule, if you are happy with Doctrine, then use entities. However, if you want your bundle be independent of any persistence layer and have extra features and services injected into your...