Good morning (at least in Arizona).
I am running a simple validation check on a Model. Nothing fancy.
$this->loadModel('Something');
$data = array(
'foo_id' => '1',
'bar' => 'John'
);
$this->Something->save($data);
----------------------------------------
class Something extends AppModel {
public $validate = array(
'foo_id' => array(
'notEmpty' => array(
'rule' => 'notEmpty',
'message' => 'Foo id is missing',
'required' => true
),
'naturalNumber' => array(
'rule' => 'naturalNumber',
'message' => 'Foo id must be greater than 0',
'required' => true
)
)
);
}
This should be easy but Something.foo_id
always fails the natural number validation. Notice that Something.id
is not defined, so save()
should run an INSERT
. I have confirmed the value is greater than 0 and have even forced it to be an integer. I'm out of ideas and would appreciate if anyone could hazard a guess at what's going on. Thanks a lot for the help.