Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 22nd, 2010 | Syntax: PHP | Size: 0.63 KB | Hits: 115 | Expires: Never
Copy text to clipboard
  1.  public function configure()
  2.   {
  3.    $this->validatorSchema->setPostValidator(
  4.       new sfValidatorCallback(array('callback' => array($this, 'checkRefund')))
  5.     );
  6.        
  7.   }
  8. }
  9.   public function checkRefund($validator, $values)
  10.   {
  11.     if ((!empty($values['result_id']) && $values['result_id'] == 3) && $values['cancel_reason'] ==  '')
  12.     {
  13.       $error = new sfValidatorError($validator, 'Vous devez prĂ©ciser la raison de cette annulation');
  14.    
  15.       // throw an error bound to the password field
  16.       throw new sfValidatorErrorSchema($validator, array('cancel_reason' => $error));
  17.     }
  18.    
  19.     return $values;
  20.   }