Hi all, I am having some trouble with the following method in one of my Models
public function assignUserRole($user, $project, $role){
Yii::log('into assignUserRole','info', 'models.ProjectController');
$this->projectId = $project;
$this->userId = $user;
$this->role = $role;
Yii::log('projectId= '.$this->projectId." userId = ".$this->userId." role = ".$this->role,'info', 'models.ProjectController');
$this->dateAssigned = date(DateTime::ISO8601);
print_r($this->errors);
if(!$this->save()){
CVarDumper::dump($this->getErrors());
}else{ return true;}
}
The method is returning true however nothing is being saved in my DB.
the print_r($this->errors); line is just printing array( ) to my browser.
nothing of interest is being logged - here is my application log
2013/03/17 22:48:38 [info] [models.ProjectController] into assignUserRole
in /Applications/MAMP/htdocs/inkwiki/protected/models/ProjectTeam.php (106)
in /Applications/MAMP/htdocs/inkwiki/protected/controllers/InviteController.php (126)
in /Applications/MAMP/htdocs/inkwiki/index.php (13)
2013/03/17 22:48:38 [info] [models.ProjectController] projectId= 49 userId = 2 role = member
in /Applications/MAMP/htdocs/inkwiki/protected/models/ProjectTeam.php (110)
in /Applications/MAMP/htdocs/inkwiki/protected/controllers/InviteController.php (126)
in /Applications/MAMP/htdocs/inkwiki/index.php (13)
I have tried setting save(false) - this makes no difference, still get no log data and nothing is saved to the DB.
Any idea why this isn’t working for me?
Thanks in advance!