On Sun, Jan 13, 2013 at 5:04 AM, AD7six <[email protected]> wrote: > > Youre better off not merging validation rules together like that rather: > > public $validate = array( > 'email' => array( > 'emailOrUrl' => array( > 'rule' => 'validateEmailOrUrl', > 'message' => 'Email or url are required' > ), > 'email' => array( > 'rule' => 'email', > 'message' => 'Type a real email, yo' > ) > ), > 'email' => array( > 'emailOrUrl' => array( > 'rule' => 'validateEmailOrUrl', > 'message' => 'Email or url are required' > ), > 'email' => array( > 'rule' => 'url', > 'message' => 'Type a real url, yo' > ) > ) > ); > > public function validateEmailOrUrl() { > return !(empty($this->data[$this->alias]['email'] && > empty($this->data[$this->alias]['url'])); > } > > Otherwise it's just another form of repetition.
Thanks for the tip, Andy. I like that approach much more. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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]. Visit this group at http://groups.google.com/group/cake-php?hl=en.
