Member-only story
Stop Using Entities in Symfony Forms
Do you use domain entities in your Symfony Forms? Let‘s transfer data from forms correctly.

Do you use your Doctrine Entities in Symfony Forms? You should stop doing that. Mixing layers that should not cross never ends well. At least in larger applications.
There is nothing wrong with this approach if developing a simple CRUD application. Things might get messy as your models grow in logic and complexity.
Today we will be building a web platform where people can post advertisements. Consider a typical controller example for a common scenario — updating an object’s details in the database:
For this method to work, your entities must contain getters and setters to access individual properties of the Advertisement class: