Changeset 1575
- Timestamp:
- 05/22/08 15:34:44 (4 months ago)
- Files:
-
- trunk/src/main/php/net/stubbles/ipo/request/broker/annotations/stubPreselectFilterAnnotation.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/broker/stubRequestBroker.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/request/filter/stubValidatorFilterDecorator.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/ipo/request/broker/annotations/stubPreselectFilterAnnotationTestCase.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/request/broker/annotations/stubPreselectFilterAnnotation.php
r1574 r1575 34 34 */ 35 35 protected $sourceDataMethod = 'getData'; 36 /** 37 * the error id to use in case the validation fails 38 * 39 * @var string 40 */ 41 protected $errorId = 'FIELD_WRONG_VALUE'; 36 42 37 43 /** … … 56 62 57 63 /** 64 * sets the error id to be used 65 * 66 * @param string $errorId 67 */ 68 public function setErrorId($errorId) 69 { 70 $this->errorId = $errorId; 71 } 72 73 /** 58 74 * returns the filter defined by the annotation 59 75 * … … 62 78 protected function doGetFilter() 63 79 { 64 $preselectData = $this->sourceDataClass->getMethod($this->sourceDataMethod)->invoke(null); 65 return new stubValidatorFilterDecorator(new stubStringFilter(), 66 $this->createRVEFactory(), 67 new stubPreSelectValidator($preselectData) 68 ); 80 $preselectData = $this->sourceDataClass->getMethod($this->sourceDataMethod)->invoke(null); 81 $validatorFilterDecorator = new stubValidatorFilterDecorator(new stubStringFilter(), 82 $this->createRVEFactory(), 83 new stubPreSelectValidator($preselectData) 84 ); 85 $validatorFilterDecorator->setErrorId($this->errorId); 86 return $validatorFilterDecorator; 69 87 } 70 88 } trunk/src/main/php/net/stubbles/ipo/request/broker/stubRequestBroker.php
r1323 r1575 14 14 'net::stubbles::ipo::request::broker::annotations::stubMailFilterAnnotation', 15 15 'net::stubbles::ipo::request::broker::annotations::stubPasswordFilterAnnotation', 16 'net::stubbles::ipo::request::broker::annotations::stubPreselectFilterAnnotation', 16 17 'net::stubbles::ipo::request::broker::annotations::stubStringFilterAnnotation', 17 18 'net::stubbles::ipo::request::broker::annotations::stubTextFilterAnnotation', trunk/src/main/php/net/stubbles/ipo/request/filter/stubValidatorFilterDecorator.php
r1547 r1575 43 43 $this->setDecoratedFilter($filter); 44 44 $this->rveFactory = $rveFactory; 45 $this->validator = $validator;45 $this->validator = $validator; 46 46 } 47 47 trunk/src/test/php/net/stubbles/ipo/request/broker/annotations/stubPreselectFilterAnnotationTestCase.php
r1574 r1575 70 70 $validatorFilterDecorator = $this->preselectFilterAnnotation->getFilter(); 71 71 $this->assertType('stubValidatorFilterDecorator', $validatorFilterDecorator); 72 $this->assertEquals('FIELD_WRONG_VALUE', $validatorFilterDecorator->getErrorId()); 72 73 $validator = $validatorFilterDecorator->getValidator(); 73 74 $this->assertType('stubPreSelectValidator', $validator); … … 83 84 { 84 85 $this->preselectFilterAnnotation->setSourceDataMethod('getBaz'); 86 $this->preselectFilterAnnotation->setErrorId('OTHER_ID'); 85 87 $validatorFilterDecorator = $this->preselectFilterAnnotation->getFilter(); 86 88 $this->assertType('stubValidatorFilterDecorator', $validatorFilterDecorator); 89 $this->assertEquals('OTHER_ID', $validatorFilterDecorator->getErrorId()); 87 90 $validator = $validatorFilterDecorator->getValidator(); 88 91 $this->assertType('stubPreSelectValidator', $validator);
