Make insert in other table when creating in a CRUD

For the following database:

TABLES:


user: [id,username]

project: [id,name]

project_user_assignment: [user_id,project_id,role]



When a new project is being created I’d like to show a dropdown with the available users to manage the project and when saving it insert into project_user_assignment the row

[user_id,project_id,‘manager’]

I’m starter with yii and don’t know where (class,method) I must do the insert and how to return an error if in the moment of the insert the query fails

Hi Addev,

Welcome to forums.

I may start to describe all the process here, but to get the basic Yii understanding, I think it’s the best to start with Yii tutorials and books

If you need more specific documentation, please read about

dropDownList

how to work with database

Hope it’ll help,

Yuga