I have 3 tables: User (ID, Name) | Tutorial (ID, Tutcontent) | UserTutorial (ID, IDUser, IDTutorial). I use this code to save the model
$user = User::model()->findByPk(1);
$tutorial = Tutorial::model()->findByPk(1);
$userTutorial = new UserTutorial;
$userTutorial->IDUser = $user->ID;
$userTutorial->IDTutorial = $tutorial->ID;
$userTutorial->save();
It does not save the new entry in mydatabase
source
share