Employee B Joins Company A, which controller should "Join" action in?

I am design a demo app for learning Yii.

Model

  • Employee

  • Company

Controller

  • CompanyController (to handle the company CRUD)

  • EmployeeController (to handle the employee CRUD)

But when a employee wants to join a company, I am not sure if "join" action should be in companyController or employeeController.

"Join" involves both employee and company.

Here is a more generalized situation:

Employee sends Message to Company.

The "send" shoudl be in Employee controller, Message controller, or Company controller?

Thanks!

Hi,

It’s probably not that important but if you wanted you could create an Admin controller that performs work on multiple models.

If you change the verb to ‘add’ it all becomes clear, I think.


company->add('employee')

Thanks!