Changeset 1925

Show
Ignore:
Timestamp:
05/11/07 10:32:35 (20 months ago)
Author:
dominik
Message:

Make the not operator hide all child errors and set the affected fields accordingly
closes #495

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/src/validator/AgaviNotoperatorValidator.class.php

    r1746 r1925  
    5353 
    5454  /** 
     55   * Adds a validation result for a given field. 
     56   * 
     57   * @param      AgaviValidator The validator. 
     58   * @param      string The name of the field which has been validated. 
     59   * @param      int    The result of the validation. 
     60   * 
     61   * @author     Dominik del Bondio <ddb@bitxtender.com> 
     62   * @since      0.11.0 
     63   */ 
     64  public function addFieldResult($validator, $fieldname, $result) 
     65  { 
     66    // prevent reporting of any child validators 
     67  } 
     68 
     69  /** 
     70   * Adds an incident to the validation result.  
     71   * 
     72   * @param      AgaviValidationIncident The incident. 
     73   * 
     74   * @author     Dominik del Bondio <ddb@bitxtender.com> 
     75   * @since      0.11.0 
     76   */ 
     77  public function addIncident(AgaviValidationIncident $incident) 
     78  { 
     79    // prevent reporting of any child validators 
     80  } 
     81 
     82  /** 
    5583   * Validates the operator by returning the inverse result of the child  
    5684   * validator 
     
    7098    if($result == AgaviValidator::CRITICAL || $result == AgaviValidator::SUCCESS) { 
    7199      $this->result = max(AgaviValidator::ERROR, $result); 
    72       $this->throwError(); 
     100      $this->throwError(null, $child->getFullArgumentNames()); 
    73101      return false; 
    74102    } else { 
     103      // lets mark the fields of the child validator all as successful 
     104      $affectedFields = $child->getFullArgumentNames(); 
     105      foreach($affectedFields as $field) { 
     106        parent::addFieldResult($this, $field, AgaviValidator::SUCCESS); 
     107      } 
    75108      return true; 
    76109    }