I have a service in which I inject the entity manager service (@doctrine.orm.entity_manager) because I have to do some queries. Technically, what is the best place for this queries? functions inside my service class or in repositories for each entity and then I can call this repositories functions.
I have a service in which I inject the entity manager service (@doctrine.orm.entity_manager) because
Share
Any query-logic should be put in the repository-classes, so you have all this logic bundled correctly into a single class per entity. This makes it easier to reuse the queries in other places (you never know when this comes in useful), and also easier to refactor in case something needs to be changed at some point.