symfony / maker-bundle

Symfony Maker Bundle
https://symfony.com/
MIT License
3.36k stars 405 forks source link

[RFC]Add make:manager command #335

Closed TheGarious closed 4 years ago

TheGarious commented 5 years ago

I think is a good idea to implement this feature to create manager, who is between controller and repository entity.

What do you think?

ro0NL commented 5 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.

TheGarious commented 5 years ago

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

ismail1432 commented 5 years ago

Your manager will contains flush remove persist ?

TheGarious commented 5 years ago

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 ?

TheGarious commented 4 years ago

Up ? I create this command or not ?

weaverryan commented 4 years ago

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!

chapterjason commented 4 years ago

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:

For other services like the UserService it would be something like: