Hey, I’m trying to save a model (via insert), but it’s not working. Here’s my save code:
$rulecompete = new UserRuleCompetitorsPerRule();
$rulecompete->competitor_id = intval($val); // this is a foreign ID
$rulecompete->rule_set_id = intval($userRuleSett_model->id); // another foreign ID
$rulecompete->save(false);
I’ve debugged for a while:
[list=1]
[*]save returns true
[*]i’ve checked and it even validates properly
[*]->getErrors is empty
[/list]
But still the data just DOESN’T save to the database.
The weirder thing is, that it DID save before. It only recently stopped working.
Any idea what’s going on? How I can debug this further? application.log is empty.
CREATE TABLE `user_rule_competitors_per_rule` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rule_set_id` int(11) NOT NULL,
`competitor_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=latin1
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('rule_set_id, competitor_id', 'required'),
array('rule_set_id, competitor_id', 'numerical', 'integerOnly'=>true),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, rule_set_id, competitor_id', 'safe'),
);
}
I am having the exact same problem. I thought I was going crazy. I tried the suggestion above and it worked perfectly. I still don’t know why the save isn’t working. I’m going to try to get debug going and see what I can find out there.