Hi all.
Cake is producing a fatal error when I call the validate function. I
believe I am doing it correctly, but wanted to double check as I am
still fairly new to Cake.
My (overly simplified) model looks like this
class Content extends AppModel {
var $name = 'Content';
var $useTable = false;
var $validate = array(
"sitename"=>VALID_NOT_EMPTY
);
}
The relevant function in my controller looks like this
function diff(){
//Validate Errors fails
// $this->validateErrors($this->data);
//As does Validate
$this->validate($this->data);
//a call to save works fine (and gives the validation errors)
$this->Content->save($this->data)
}
The error i am getting is
Fatal error: Call to a member function on a non-object in /removed/
cake/libs/controller/controller.php on line 514
Line 514 (I know not much use on its own) looks like
$errors = array_merge($errors, $this->{$object->name}-
>invalidFields($object->data));
The problem is that $object->name is empty.
Am I using the function incorrectly or is there something else causing
the problem.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---