1

would like to ask if is there a way that I can group multiple rules in the model into 1 so that i can reduce the amount of codes especially on places where same attribute needed to be check on multiple rules... Below is how the rules declaration now...

            array (
                    'new_email_addr',
                    'email',
                    'on' => 'chngEmail'
            ),
            array (
                    'new_email_addr',
                    'required',
                    'on' => 'chngEmail'
            ),
            array (
                    'new_email_addr',
                    'sameEmail',
                    'on' => 'chngEmail'
            ),

As you can see, the attribute new_email_addr needs to be check on 3 rules before it is save... What I wanted to achieve is something like this so i can do everything in one section.

            array (
                    'new_email_addr',
                    'required, email, sameEmail',
                    'on' => 'chngEmail'
            ),

Is there such possibilities?

4

1 に答える 1