F
F
frontendo2017-09-23 09:40:09
Design patterns
frontendo, 2017-09-23 09:40:09

In which controller is it correct to place a method that returns group users?

There is a user entity and a UserController controller corresponding to it with get, edit, delete methods
there is a group entity and a GroupControlle controller corresponding to it with create, get, edit, delete methods
user can be in several groups, links in the user_groups table It is
necessary to place the getUsersByGroupId method processing the address / groups/:group_id/users
In which controller should this method be placed and why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Camaro67, 2017-09-23
@frontendo

Obviously not in GroupControlle. In UserController because this is where the work with the users themselves comes in. Although I would generally add a separate model for this. If I understand your problem correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question