Closed TheGarious closed 4 years ago
Hi @TheGarious, im curious :) what are you describing to be called a "manager" exactly?
In this case, cant the controller use the repository, a factory ..., or some other service of yours?
If you're aiming for something like https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Model/UserManagerInterface.php i'd say that's 99% a repository concern already. Other cases could be solved in the entity itself perhaps, by providing it rich API, or a more dedicated service of yours.
Hi @ro0NL,
For me a "manager" is a custom service between controller/service and repository.
He is like your link. We can manipulate an entity outside the controller and the manager is a solution.
Sorry for the late message,
Gary
Your manager will contains flush
remove
persist
?
Yes, call repository for flush remove, persist and flush. I use an abstract for that because i use it for all manager. Do you want an example for that ?
Up ? I create this command or not ?
Hi Gary!
I think this is too generic of a thing to add into MakerBundle (I'm not saying it's a bad pattern at all - just that a "manager" is a generic word and not a concept that will be relevant or understood by most people).
Cheers!
What about Service
, this what I like to call it, a Manager
is not correct you are right.
Service is more understandable, for example a BookingService
, you directly know that the service is there to interact with bookings. I don't mean the terms from the ObjectManager
like persist
and flush
.
It's more like:
book
cancel
change
For other services like the UserService
it would be something like:
register
activate
deactivate
I think is a good idea to implement this feature to create manager, who is between controller and repository entity.
What do you think?