Beautiful.
The only disadvantage I see is somewhat semantic. The controller
shouldn't be telling the model which validation array to use.
I wonder if this could be improved by having the model transparently
perform the $validate re-assignment in beforeValidate(), using the
current action as the key.
Something like this:
... in your model constructor:
$validateArray['login'] = $validate_login;
$validateArray['register'] = $validate_register;
... in your model's beforeValidate callback:
function beforeValidate(){
// assume $action is set to current action.
if (isset($this->validateArray[$action])) {
// reassign the $validate variable.
$validate = $this->validateArray[$action];
}
}
etc .
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---