'/^(|[0-9]+)$/', 'first_name' => VALID_NOT_EMPTY, 'last_name' => VALID_NOT_EMPTY, 'gender' => '/^[mf]$/', 'date_of_birth' => VALID_DATE, 'registration_date' => VALID_DATE, 'email' => VALID_EMAIL, ); function afterSaveFailed() { $failed_constraint = $this->checkFailedConstraint(); if($failed_constraint) { // player has 2 constraints: (email), and (first_name,last_name,date_of_birth,school_id). // let's see if it was the email. if ($failed_constraint == $this->data['Player']['email']) { $this->invalidate('email_duplicate'); } else { $this->invalidate('everything_else_duplicate'); } } } } ?>