Show
Ignore:
Timestamp:
07/09/08 16:11:38 (6 months ago)
Author:
dominik
Message:

allow using the AgaviDateDefinitions? constants in addition to the constant names when creating the datetime validator manually
closes #760

Files:
1 modified

Legend:

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

    r2258 r2602  
    109109        if(defined($calField)) { 
    110110          $calField = constant($calField); 
    111  
    112           if($calField == AgaviDateDefinitions::MONTH) { 
    113             $param -= 1; 
    114           } 
    115  
    116           $cal->set($calField, (float) $param); 
    117         } 
     111        } elseif(!is_numeric($calField)) { 
     112          throw new AgaviValidatorException('Unknown argument name "' . $calField . '" for argument "' . $field . '" supplied. This needs to be one of the constants defined in AgaviDateDefinitions.'); 
     113        } 
     114 
     115        if($calField == AgaviDateDefinitions::MONTH) { 
     116          $param -= 1; 
     117        } 
     118 
     119        $cal->set($calField, (float) $param); 
    118120      } 
    119121