/**
  * @see sfValidatorFile
  */
 protected function doClean($value)
 {
     $clean = parent::doClean($value);
     if ($clean == 0) {
         throw new sfValidatorError($this, 'not_nullity');
     }
     return $clean;
 }
 /**
  * @see sfValidatorBase
  */
 protected function doClean($value)
 {
     $value = $this->convertToEnglishNumber($value);
     if (!preg_match('#^[\\d\\.]+$#', $value)) {
         throw new sfValidatorError($this, 'invalid', array('value' => $value));
     }
     return parent::doClean($value);
 }
 protected function doClean($value)
 {
     if (preg_match_all('/[\\.,]/', $value, $matches) > 1) {
         throw new sfValidatorError($this, 'Only one decimal separator is allowed');
     }
     // Translate to US-standard
     $pre_clean = preg_replace('/,/', '.', $value);
     $post_clean = parent::doClean($pre_clean);
     return $post_clean;
 }
Exemplo n.º 4
0
 /**
  * @see sfValidatorBase
  */
 protected function doClean($value)
 {
     try {
         $value = sfNumberFormatPlus::getNumber($value, $this->getOption('culture'));
     } catch (Exception $e) {
         //print_r($e);
         throw new sfValidatorError($this, 'format', array('value' => $value));
     }
     return parent::doClean($value);
 }
 /**
  * @see sfValidatorFile
  */
 protected function doClean($value)
 {
     $clean = parent::doClean($value['montant']);
     switch ($value['state']) {
         case 'debit':
             $clean = abs($clean) * -1;
             break;
         case 'credit':
             $clean = abs($clean);
             break;
     }
     return $clean;
 }