Changeset 1575

Show
Ignore:
Timestamp:
05/22/08 15:34:44 (4 months ago)
Author:
mikey
Message:

enable setting of error id to use
load annotation with request broker

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/ipo/request/broker/annotations/stubPreselectFilterAnnotation.php

    r1574 r1575  
    3434     */ 
    3535    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'; 
    3642 
    3743    /** 
     
    5662 
    5763    /** 
     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    /** 
    5874     * returns the filter defined by the annotation 
    5975     * 
     
    6278    protected function doGetFilter() 
    6379    { 
    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; 
    6987    } 
    7088} 
  • trunk/src/main/php/net/stubbles/ipo/request/broker/stubRequestBroker.php

    r1323 r1575  
    1414                      'net::stubbles::ipo::request::broker::annotations::stubMailFilterAnnotation', 
    1515                      'net::stubbles::ipo::request::broker::annotations::stubPasswordFilterAnnotation', 
     16                      'net::stubbles::ipo::request::broker::annotations::stubPreselectFilterAnnotation', 
    1617                      'net::stubbles::ipo::request::broker::annotations::stubStringFilterAnnotation', 
    1718                      'net::stubbles::ipo::request::broker::annotations::stubTextFilterAnnotation', 
  • trunk/src/main/php/net/stubbles/ipo/request/filter/stubValidatorFilterDecorator.php

    r1547 r1575  
    4343        $this->setDecoratedFilter($filter); 
    4444        $this->rveFactory = $rveFactory; 
    45         $this->validator      = $validator; 
     45        $this->validator  = $validator; 
    4646    } 
    4747 
  • trunk/src/test/php/net/stubbles/ipo/request/broker/annotations/stubPreselectFilterAnnotationTestCase.php

    r1574 r1575  
    7070        $validatorFilterDecorator = $this->preselectFilterAnnotation->getFilter(); 
    7171        $this->assertType('stubValidatorFilterDecorator', $validatorFilterDecorator); 
     72        $this->assertEquals('FIELD_WRONG_VALUE', $validatorFilterDecorator->getErrorId()); 
    7273        $validator = $validatorFilterDecorator->getValidator(); 
    7374        $this->assertType('stubPreSelectValidator', $validator); 
     
    8384    { 
    8485        $this->preselectFilterAnnotation->setSourceDataMethod('getBaz'); 
     86        $this->preselectFilterAnnotation->setErrorId('OTHER_ID'); 
    8587        $validatorFilterDecorator = $this->preselectFilterAnnotation->getFilter(); 
    8688        $this->assertType('stubValidatorFilterDecorator', $validatorFilterDecorator); 
     89        $this->assertEquals('OTHER_ID', $validatorFilterDecorator->getErrorId()); 
    8790        $validator = $validatorFilterDecorator->getValidator(); 
    8891        $this->assertType('stubPreSelectValidator', $validator);