Changeset 1033
- Timestamp:
- 11/12/07 16:51:23 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/request/filters/stubAbstractStringFilter.php
r1012 r1033 47 47 */ 48 48 protected $encoderMode = stubStringEncoder::MODE_DECODE; 49 /** 50 * default value for empty field 51 * 52 * @var string 53 */ 54 protected $emptyErrorId = 'FIELD_EMPTY'; 49 55 56 /** 57 * set a min length validator 58 * 59 * @param stubValidator $minLength 60 */ 61 public function setEmptyErrorId($errorId) 62 { 63 $this->emptyErrorId = $errorId; 64 } 65 50 66 /** 51 67 * set a min length validator … … 133 149 // if input length is zero but input is required 134 150 if ((null == $value || strlen($value) == 0) && true == $this->isRequired) { 135 throw new stubFilterException($this->rveFactory->create( 'FIELD_EMPTY'));151 throw new stubFilterException($this->rveFactory->create($this->emptyErrorId)); 136 152 // if input is shorter than maximal allowed length 137 153 } elseif (null != $this->minLength && $this->minLength->validate($value) == false) { trunk/src/main/php/net/stubbles/ipo/request/filters/stubStringFilter.php
r731 r1033 26 26 */ 27 27 protected $regex; 28 /** 29 * wrong value error id 30 * 31 * @var stubValidator 32 */ 33 protected $wrongValueErrorId; 28 34 29 35 /** … … 33 39 * @param stubValidator $regex validator to use for checking the string 34 40 */ 35 public function __construct(stubRequestValueErrorFactory $rveFactory, stubValidator $regex )41 public function __construct(stubRequestValueErrorFactory $rveFactory, stubValidator $regex, $wrongValueErrorId = 'FIELD_WRONG_VALUE') 36 42 { 37 $this->rveFactory = $rveFactory; 38 $this->regex = $regex; 43 $this->rveFactory = $rveFactory; 44 $this->regex = $regex; 45 $this->wrongValueErrorId = $wrongValueErrorId; 39 46 } 40 47 … … 64 71 65 72 if ($this->regex->validate($value) == false) { 66 throw new stubFilterException($this->rveFactory->create( 'FIELD_WRONG_VALUE'));73 throw new stubFilterException($this->rveFactory->create($this->wrongValueErrorId)); 67 74 } 68 75 }
