Say you wanted to do validation on a users table, so in your model you
define in your beforeValidates function 2 rules, one to check if the
username already existed (for registering a new user), and one to
check if the username was present in the table (for logging in).

Instead of creating a couple of functions called validateRegister and
validateLogin (which have each of the rules for validation inside)
which you would call in different places in your controller logic, you
could keep your beforeValidates function which then uses the
controller action (via a reference) to run a function based on it
(beforeValidatesRegister / beforeValidatesLogin).

You could pass the controller action in via a this->User->set(....) in
the controller and use that but i could do it in one hit with a
reference and have access to other stuff (maybe the controller name or
URL or something).

Any thoughts on the best way to achieve what i want?


On Jun 18, 1:11 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> A better solution for me would be to pass the Controller as a
> > reference to the model and call functions on the app_controller such
> > as getAction()
>
> > Does that make sense?
>
> Not really, can you elaborate?
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to