Example #1
0
 public function validate($save_method)
 {
     Pfw_Loader::loadClass('Pfw_Validate');
     $pfv = new Pfw_Validate($this);
     if (Pfw_Model::SAVE_INSERT == $save_method) {
         $pfv->presence('name', "required!");
         $pfv->presence('description', "required!");
     }
     return $pfv->success();
 }
Example #2
0
 public function validate($save_method)
 {
     Pfw_Loader::loadClass('Pfw_Validate');
     $pfv = new Pfw_Validate($this);
     if (Pfw_Model::SAVE_INSERT == $save_method) {
         $pfv->presence('first_name', "required!");
         $pfv->presence('last_name', "required!");
         $pfv->presence('email', "required!");
         $pfv->email('email', "Email is invalid!");
         $pfv->presence('password', "required!");
         if ($pfv->presence('email', "required!")) {
             $email_user = User::Q()->getByEmail($this->email)->exec();
             if (!empty($email_user)) {
                 $this->addError('email', "email is taken");
                 $pfv->fail();
             }
         }
     }
     return $pfv->success();
 }