After searching this group for a while, still can't find the solution
to my problem:
In the User-Model beforeSave()-function I want to do some stuff
depending on the role of the user. there is a 'role'-field in the db
which is already assigned. The following code works, if there is a
hidden 'role'-field in the edit-form:
function beforeSave()
{
if ($this->data['User']['role'] == 'admin')
{
$this->_doSomething();
}
return true;
}
Without a hidden 'role'-field in the edit-form I don't have access to
the role value from within the model and get the following notice:
Notice (8): Undefined index: role
Putting every internal value of a model into a hidden field does not
seem like a very good practice to me. I'm shure, there must be a
simple solution to this. What would be the right way to access model
values from within a model?
Environment: CakePHP 1.2, PHP, MySQL
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---