Re: Case by case validation

2008-02-06 Thread Robby Anderson
Using cake's automagic, you could add to your model's beforeSave() method, doing this: 1) Save a temp copy of $this->validate 2) Create and assign a new version of $this->validate, based on the state (create vs update) 3) Get the return value of $this->validates() - a true return value means you

Re: Case by case validation

2008-02-06 Thread Dardo Sordi Bogado
That should work, but increases coupling in the system. On Feb 6, 2008 5:07 PM, b logica <[EMAIL PROTECTED]> wrote: > > On Feb 3, 2008 7:13 AM, cronet <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > > > how realising case by case validation ?? (

Re: Case by case validation

2008-02-06 Thread b logica
On Feb 3, 2008 7:13 AM, cronet <[EMAIL PROTECTED]> wrote: > > Hello, > > > how realising case by case validation ?? (e.g. A form need to validate > different for a user logged in, or not logged in) > > First, I thought about creating two different Models with th

Re: Case by case validation

2008-02-05 Thread grigri
x27;on' => 'create' or 'update' rules, > > but maybe you can sort of extend that to add more states, like 'on' => > > 'logged'. > > > Cheers, > > > On Feb 3, 2008 10:13 AM, cronet <[EMAIL PROTECTED]> wrote: >

Re: Case by case validation

2008-02-05 Thread Dardo Sordi Bogado
ow cake's implement the 'on' => 'create' or 'update' rules, > but maybe you can sort of extend that to add more states, like 'on' => > 'logged'. > > Cheers, > > > On Feb 3, 2008 10:13 AM, cronet <[EMAIL PROTECTE

Re: Case by case validation

2008-02-05 Thread Matias Lespiau
' => 'logged'. Cheers, On Feb 3, 2008 10:13 AM, cronet <[EMAIL PROTECTED]> wrote: > > Hello, > > > how realising case by case validation ?? (e.g. A form need to validate > different for a user logged in, or not logged in) > > First, I thought about cre

Case by case validation

2008-02-03 Thread cronet
Hello, how realising case by case validation ?? (e.g. A form need to validate different for a user logged in, or not logged in) First, I thought about creating two different Models with the different validation cases. But what about the funcitons I need for the models which I would pack in the