When I read docs about repositories, it is often to work with entities & collection but in a "read-only" manner.
There are never examples where repositories have methods like insertUser(User $user)
or updateUser(User $user)
.
However, when using SOA, Service should not be working with Entity Manager (that's right, isn't it?) so:
- Should my service be aware of the global EntityManager?
- Should my service know only about the used Repositories (let's say, UserRepository & ArticleRepository)
From that both questions, another one, should my service ever explicitly persist()
& flush()
my entities ?