Development

Changeset 32423

You must first sign up to be able to contribute.

Changeset 32423

Show
Ignore:
Timestamp:
03/30/11 23:30:07 (3 years ago)
Author:
fabien
Message:

Merge branch 'master' of git://github.com/symfony/symfony

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.0/src/Symfony/Bundle/DoctrineMongoDBBundle/Validator/Constraints/Unique.php

    r32184 r32423  
    2525    public $documentManager; 
    2626 
    27     public function defaultOption() 
     27    public function getDefaultOption() 
    2828    { 
    2929        return 'path'; 
    3030    } 
    3131 
    32     public function requiredOptions() 
     32    public function getRequiredOptions() 
    3333    { 
    3434        return array('path'); 
     
    4040    } 
    4141 
    42     public function targets() 
     42    public function getTargets() 
    4343    { 
    4444        return Constraint::CLASS_CONSTRAINT; 
  • branches/2.0/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml

    r32184 r32423  
    1515        <parameter key="validator.mapping.loader.xml_files_loader.class">Symfony\Component\Validator\Mapping\Loader\XmlFilesLoader</parameter> 
    1616        <parameter key="validator.mapping.loader.yaml_files_loader.class">Symfony\Component\Validator\Mapping\Loader\YamlFilesLoader</parameter> 
    17         <parameter key="validator.mapping.loader.static_method_loader.method_name">loadValidatorMetadata</parameter> 
    1817        <parameter key="validator.validator_factory.class">Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory</parameter> 
    1918        <parameter key="validator.annotations.namespaces" type="collection"> 
     
    4544        </service> 
    4645 
    47         <service id="validator.mapping.loader.static_method_loader" class="%validator.mapping.loader.static_method_loader.class%" public="false"> 
    48             <argument>%validator.mapping.loader.static_method_loader.method_name%</argument> 
    49         </service> 
     46        <service id="validator.mapping.loader.static_method_loader" class="%validator.mapping.loader.static_method_loader.class%" public="false" /> 
    5047 
    5148    </services> 
  • branches/2.0/src/Symfony/Component/Validator/Constraint.php

    r32184 r32423  
    5959     * properties. 
    6060     * 
    61      * Alternatively you can override the method defaultOption() to return the 
     61     * Alternatively you can override the method getDefaultOption() to return the 
    6262     * name of an existing property. If no associative array is passed, this 
    6363     * property is set instead. 
    6464     * 
    6565     * You can force that certain options are set by overriding 
    66      * requiredOptions() to return the names of these options. If any 
     66     * getRequiredOptions() to return the names of these options. If any 
    6767     * option is not set here, an exception is thrown. 
    6868     * 
     
    7474     *                                       options 
    7575     * @throws MissingOptionsException       When you don't pass any of the options 
    76      *                                       returned by requiredOptions() 
     76     *                                       returned by getRequiredOptions() 
    7777     * @throws ConstraintDefinitionException When you don't pass an associative 
    78      *                                       array, but defaultOption() returns 
     78     *                                       array, but getDefaultOption() returns 
    7979     *                                       NULL 
    8080     */ 
     
    8282    { 
    8383        $invalidOptions = array(); 
    84         $missingOptions = array_flip((array)$this->requiredOptions()); 
     84        $missingOptions = array_flip((array)$this->getRequiredOptions()); 
    8585 
    8686        if (is_array($options) && count($options) == 1 && isset($options['value'])) { 
     
    9898            } 
    9999        } else if (null !== $options && ! (is_array($options) && count($options) === 0)) { 
    100             $option = $this->defaultOption(); 
     100            $option = $this->getDefaultOption(); 
    101101 
    102102            if (null === $option) { 
     
    159159     * @see __construct() 
    160160     */ 
    161     public function defaultOption() 
     161    public function getDefaultOption() 
    162162    { 
    163163        return null; 
     
    172172     * @see __construct() 
    173173     */ 
    174     public function requiredOptions() 
     174    public function getRequiredOptions() 
    175175    { 
    176176        return array(); 
     
    188188    public function validatedBy() 
    189189    { 
    190         return get_class($this) . 'Validator'; 
     190        return get_class($this).'Validator'; 
    191191    } 
    192192 
     
    200200     * @return string|array  One or more constant values 
    201201     */ 
    202     abstract public function targets(); 
     202    abstract public function getTargets(); 
    203203} 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/All.php

    r32184 r32423  
    1616    public $constraints = array(); 
    1717 
    18     public function defaultOption() 
     18    public function getDefaultOption() 
    1919    { 
    2020        return 'constraints'; 
    2121    } 
    2222 
    23     public function requiredOptions() 
     23    public function getRequiredOptions() 
    2424    { 
    2525        return array('constraints'); 
     
    2929     * {@inheritDoc} 
    3030     */ 
    31     public function targets() 
     31    public function getTargets() 
    3232    { 
    3333        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Blank.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Callback.php

    r32369 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function requiredOptions() 
     21    public function getRequiredOptions() 
    2222    { 
    2323        return array('methods'); 
     
    2727     * {@inheritDoc} 
    2828     */ 
    29     public function defaultOption() 
     29    public function getDefaultOption() 
    3030    { 
    3131        return 'methods'; 
     
    3535     * {@inheritDoc} 
    3636     */ 
    37     public function targets() 
     37    public function getTargets() 
    3838    { 
    3939        return self::CLASS_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Choice.php

    r32184 r32423  
    2626     * {@inheritDoc} 
    2727     */ 
    28     public function defaultOption() 
     28    public function getDefaultOption() 
    2929    { 
    3030        return 'choices'; 
     
    3434     * {@inheritDoc} 
    3535     */ 
    36     public function targets() 
     36    public function getTargets() 
    3737    { 
    3838        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Collection.php

    r32184 r32423  
    2020    public $missingFieldsMessage = 'The fields {{ fields }} are missing'; 
    2121 
    22     public function requiredOptions() 
     22    public function getRequiredOptions() 
    2323    { 
    2424        return array('fields'); 
     
    2828     * {@inheritDoc} 
    2929     */ 
    30     public function targets() 
     30    public function getTargets() 
    3131    { 
    3232        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Country.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Date.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/DateTime.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Email.php

    r32184 r32423  
    2020     * {@inheritDoc} 
    2121     */ 
    22     public function targets() 
     22    public function getTargets() 
    2323    { 
    2424        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/False.php

    r32391 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/File.php

    r32184 r32423  
    2424     * {@inheritDoc} 
    2525     */ 
    26     public function targets() 
     26    public function getTargets() 
    2727    { 
    2828        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Ip.php

    r32184 r32423  
    5050     * {@inheritDoc} 
    5151     */ 
    52     public function targets() 
     52    public function getTargets() 
    5353    { 
    5454        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Language.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Locale.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Max.php

    r32184 r32423  
    2020     * {@inheritDoc} 
    2121     */ 
    22     public function defaultOption() 
     22    public function getDefaultOption() 
    2323    { 
    2424        return 'limit'; 
     
    2828     * {@inheritDoc} 
    2929     */ 
    30     public function requiredOptions() 
     30    public function getRequiredOptions() 
    3131    { 
    3232        return array('limit'); 
     
    3636     * {@inheritDoc} 
    3737     */ 
    38     public function targets() 
     38    public function getTargets() 
    3939    { 
    4040        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/MaxLength.php

    r32184 r32423  
    2121     * {@inheritDoc} 
    2222     */ 
    23     public function defaultOption() 
     23    public function getDefaultOption() 
    2424    { 
    2525        return 'limit'; 
     
    2929     * {@inheritDoc} 
    3030     */ 
    31     public function requiredOptions() 
     31    public function getRequiredOptions() 
    3232    { 
    3333        return array('limit'); 
     
    3737     * {@inheritDoc} 
    3838     */ 
    39     public function targets() 
     39    public function getTargets() 
    4040    { 
    4141        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Min.php

    r32184 r32423  
    2020     * {@inheritDoc} 
    2121     */ 
    22     public function defaultOption() 
     22    public function getDefaultOption() 
    2323    { 
    2424        return 'limit'; 
     
    2828     * {@inheritDoc} 
    2929     */ 
    30     public function requiredOptions() 
     30    public function getRequiredOptions() 
    3131    { 
    3232        return array('limit'); 
     
    3636     * {@inheritDoc} 
    3737     */ 
    38     public function targets() 
     38    public function getTargets() 
    3939    { 
    4040        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/MinLength.php

    r32184 r32423  
    2121     * {@inheritDoc} 
    2222     */ 
    23     public function defaultOption() 
     23    public function getDefaultOption() 
    2424    { 
    2525        return 'limit'; 
     
    2929     * {@inheritDoc} 
    3030     */ 
    31     public function requiredOptions() 
     31    public function getRequiredOptions() 
    3232    { 
    3333        return array('limit'); 
     
    3737     * {@inheritDoc} 
    3838     */ 
    39     public function targets() 
     39    public function getTargets() 
    4040    { 
    4141        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/NotBlank.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/NotNull.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Null.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Regex.php

    r32184 r32423  
    2121     * {@inheritDoc} 
    2222     */ 
    23     public function defaultOption() 
     23    public function getDefaultOption() 
    2424    { 
    2525        return 'pattern'; 
     
    2929     * {@inheritDoc} 
    3030     */ 
    31     public function requiredOptions() 
     31    public function getRequiredOptions() 
    3232    { 
    3333        return array('pattern'); 
     
    3737     * {@inheritDoc} 
    3838     */ 
    39     public function targets() 
     39    public function getTargets() 
    4040    { 
    4141        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Time.php

    r32184 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/True.php

    r32391 r32423  
    1919     * {@inheritDoc} 
    2020     */ 
    21     public function targets() 
     21    public function getTargets() 
    2222    { 
    2323        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Type.php

    r32391 r32423  
    2020     * {@inheritDoc} 
    2121     */ 
    22     public function defaultOption() 
     22    public function getDefaultOption() 
    2323    { 
    2424        return 'type'; 
     
    2828     * {@inheritDoc} 
    2929     */ 
    30     public function requiredOptions() 
     30    public function getRequiredOptions() 
    3131    { 
    3232        return array('type'); 
     
    3636     * {@inheritDoc} 
    3737     */ 
    38     public function targets() 
     38    public function getTargets() 
    3939    { 
    4040        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Url.php

    r32184 r32423  
    2020     * {@inheritDoc} 
    2121     */ 
    22     public function targets() 
     22    public function getTargets() 
    2323    { 
    2424        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Constraints/Valid.php

    r32184 r32423  
    2121     * {@inheritDoc} 
    2222     */ 
    23     public function targets() 
     23    public function getTargets() 
    2424    { 
    2525        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/src/Symfony/Component/Validator/Mapping/ClassMetadata.php

    r32184 r32423  
    9797    public function addConstraint(Constraint $constraint) 
    9898    { 
    99         if (!in_array(Constraint::CLASS_CONSTRAINT, (array)$constraint->targets())) { 
     99        if (!in_array(Constraint::CLASS_CONSTRAINT, (array)$constraint->getTargets())) { 
    100100            throw new ConstraintDefinitionException(sprintf( 
    101101                'The constraint %s cannot be put on classes', 
  • branches/2.0/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php

    r32184 r32423  
    1919    protected $methodName; 
    2020 
    21     public function __construct($methodName
     21    public function __construct($methodName = 'loadValidatorMetadata'
    2222    { 
    2323        $this->methodName = $methodName; 
  • branches/2.0/src/Symfony/Component/Validator/Mapping/MemberMetadata.php

    r32184 r32423  
    4545    public function addConstraint(Constraint $constraint) 
    4646    { 
    47         if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array)$constraint->targets())) { 
     47        if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array)$constraint->getTargets())) { 
    4848            throw new ConstraintDefinitionException(sprintf( 
    4949                'The constraint %s cannot be put on properties or getters', 
  • branches/2.0/src/Symfony/Component/Validator/ValidatorContext.php

    r32184 r32423  
    3636     * @inheritDoc 
    3737     */ 
    38     public function classMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory) 
     38    public function setClassMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory) 
    3939    { 
    4040        $this->classMetadataFactory = $classMetadataFactory; 
     
    4646     * @inheritDoc 
    4747     */ 
    48     public function constraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory) 
     48    public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory) 
    4949    { 
    5050        $this->constraintValidatorFactory = $constraintValidatorFactory; 
  • branches/2.0/src/Symfony/Component/Validator/ValidatorContextInterface.php

    r32184 r32423  
    2323 * <code> 
    2424 * $validator = $context 
    25  *     ->classMetadataFactory($customFactory) 
     25 *     ->setClassMetadataFactory($customFactory) 
    2626 *     ->getValidator(); 
    2727 * </code> 
     
    3636     * @param ClassMetadataFactoryInterface $classMetadataFactory  The factory instance 
    3737     */ 
    38     function classMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory); 
     38    function setClassMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory); 
    3939 
    4040    /** 
     
    4343     * @param ConstraintValidatorFactoryInterface $constraintValidatorFactory  The factory instance 
    4444     */ 
    45     function constraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory); 
     45    function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory); 
    4646 
    4747    /** 
  • branches/2.0/src/Symfony/Component/Validator/ValidatorFactory.php

    r32184 r32423  
    5252 * <code> 
    5353 * $defaultContext = new ValidatorContext(); 
    54  * $defaultContext->classMetadataFactory($metadataFactory); 
    55  * $defaultContext->constraintValidatorFactory($validatorFactory); 
     54 * $defaultContext->setClassMetadataFactory($metadataFactory); 
     55 * $defaultContext->setConstraintValidatorFactory($validatorFactory); 
    5656 * $factory = new ValidatorFactory($defaultContext); 
    5757 * 
     
    6666 * <code> 
    6767 * $form = $factory 
    68  *     ->classMetadataFactory($customFactory); 
     68 *     ->setClassMetadataFactory($customFactory); 
    6969 *     ->getValidator(); 
    7070 * </code> 
     
    144144        } 
    145145 
    146         $context->classMetadataFactory(new ClassMetadataFactory($loader)); 
    147         $context->constraintValidatorFactory(new ConstraintValidatorFactory()); 
     146        $context->setClassMetadataFactory(new ClassMetadataFactory($loader)); 
     147        $context->setConstraintValidatorFactory(new ConstraintValidatorFactory()); 
    148148 
    149149        return new static($context); 
     
    167167     * @return ValidatorContextInterface                       The preconfigured form context 
    168168     */ 
    169     public function classMetadataFactory(ClassMetadataFactoryInterface $metadataFactory) 
     169    public function setClassMetadataFactory(ClassMetadataFactoryInterface $metadataFactory) 
    170170    { 
    171171        $context = clone $this->defaultContext; 
    172172 
    173         return $context->classMetadataFactory($metadataFactory); 
     173        return $context->setClassMetadataFactory($metadataFactory); 
    174174    } 
    175175 
     
    181181     * @return ValidatorContextInterface                        The preconfigured form context 
    182182     */ 
    183     public function constraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory) 
     183    public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory) 
    184184    { 
    185185        $context = clone $this->defaultContext; 
    186186 
    187         return $context->constraintValidatorFactory($validatorFactory); 
     187        return $context->setConstraintValidatorFactory($validatorFactory); 
    188188    } 
    189189 
  • branches/2.0/tests/Symfony/Tests/Component/Validator/Fixtures/ClassConstraint.php

    r31885 r32423  
    77class ClassConstraint extends Constraint 
    88{ 
    9     public function targets() 
     9    public function getTargets() 
    1010    { 
    1111        return self::CLASS_CONSTRAINT; 
  • branches/2.0/tests/Symfony/Tests/Component/Validator/Fixtures/ConstraintA.php

    r31885 r32423  
    1010    public $property2; 
    1111 
    12     public function defaultOption() 
     12    public function getDefaultOption() 
    1313    { 
    1414        return 'property2'; 
    1515    } 
    1616 
    17     public function targets() 
     17    public function getTargets() 
    1818    { 
    1919        return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); 
  • branches/2.0/tests/Symfony/Tests/Component/Validator/Fixtures/ConstraintB.php

    r31885 r32423  
    77class ConstraintB extends Constraint { 
    88 
    9     public function targets() 
     9    public function getTargets() 
    1010    { 
    1111        return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); 
  • branches/2.0/tests/Symfony/Tests/Component/Validator/Fixtures/ConstraintC.php

    r31885 r32423  
    99    public $option1; 
    1010 
    11     public function requiredOptions() 
     11    public function getRequiredOptions() 
    1212    { 
    1313        return array('option1'); 
    1414    } 
    1515 
    16     public function targets() 
     16    public function getTargets() 
    1717    { 
    1818        return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); 
  • branches/2.0/tests/Symfony/Tests/Component/Validator/Fixtures/FailingConstraint.php

    r31885 r32423  
    99    public $message = ''; 
    1010 
    11     public function targets() 
     11    public function getTargets() 
    1212    { 
    1313        return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); 
  • branches/2.0/tests/Symfony/Tests/Component/Validator/Fixtures/PropertyConstraint.php

    r31885 r32423  
    77class PropertyConstraint extends Constraint 
    88{ 
    9     public function targets() 
     9    public function getTargets() 
    1010    { 
    1111        return self::PROPERTY_CONSTRAINT; 
  • branches/2.0/tests/Symfony/Tests/Component/Validator/ValidatorContextTest.php

    r32184 r32423  
    2727    { 
    2828        $factory = $this->getMock('Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface'); 
    29         $result = $this->context->classMetadataFactory($factory); 
     29        $result = $this->context->setClassMetadataFactory($factory); 
    3030 
    3131        $this->assertSame($this->context, $result); 
     
    3636    { 
    3737        $factory = $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface'); 
    38         $result = $this->context->constraintValidatorFactory($factory); 
     38        $result = $this->context->setConstraintValidatorFactory($factory); 
    3939 
    4040        $this->assertSame($this->context, $result); 
     
    4848 
    4949        $validator = $this->context 
    50             ->classMetadataFactory($metadataFactory) 
    51             ->constraintValidatorFactory($validatorFactory) 
     50            ->setClassMetadataFactory($metadataFactory) 
     51            ->setConstraintValidatorFactory($validatorFactory) 
    5252            ->getValidator(); 
    5353 
  • branches/2.0/tests/Symfony/Tests/Component/Validator/ValidatorFactoryTest.php

    r32184 r32423  
    3939        $factory2 = $this->getMock('Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface'); 
    4040 
    41         $this->defaultContext->classMetadataFactory($factory1); 
     41        $this->defaultContext->setClassMetadataFactory($factory1); 
    4242 
    43         $result = $this->factory->classMetadataFactory($factory2); 
     43        $result = $this->factory->setClassMetadataFactory($factory2); 
    4444 
    4545        $this->assertSame($factory1, $this->defaultContext->getClassMetadataFactory()); 
     
    5252        $factory2 = $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface'); 
    5353 
    54         $this->defaultContext->constraintValidatorFactory($factory1); 
     54        $this->defaultContext->setConstraintValidatorFactory($factory1); 
    5555 
    56         $result = $this->factory->constraintValidatorFactory($factory2); 
     56        $result = $this->factory->setConstraintValidatorFactory($factory2); 
    5757 
    5858        $this->assertSame($factory1, $this->defaultContext->getConstraintValidatorFactory()); 
     
    6666 
    6767        $this->defaultContext 
    68             ->classMetadataFactory($metadataFactory) 
    69             ->constraintValidatorFactory($validatorFactory); 
     68            ->setClassMetadataFactory($metadataFactory) 
     69            ->setConstraintValidatorFactory($validatorFactory); 
    7070 
    7171        $validator = $this->factory->getValidator(); 
     
    8383        $context = new ValidatorContext(); 
    8484        $context 
    85             ->classMetadataFactory(new ClassMetadataFactory(new AnnotationLoader())) 
    86             ->constraintValidatorFactory(new ConstraintValidatorFactory()); 
     85            ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader())) 
     86            ->setConstraintValidatorFactory(new ConstraintValidatorFactory()); 
    8787 
    8888        $this->assertEquals(new ValidatorFactory($context), $factory); 
     
    100100        $context = new ValidatorContext(); 
    101101        $context 
    102             ->classMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(array( 
     102            ->setClassMetadataFactory(new ClassMetadataFactory(new AnnotationLoader(array( 
    103103                'myns' => 'My\\Namespace\\', 
    104104            )))) 
    105             ->constraintValidatorFactory(new ConstraintValidatorFactory()); 
     105            ->setConstraintValidatorFactory(new ConstraintValidatorFactory()); 
    106106 
    107107        $this->assertEquals(new ValidatorFactory($context), $factory); 
     
    115115        $context = new ValidatorContext(); 
    116116        $context 
    117             ->classMetadataFactory(new ClassMetadataFactory(new XmlFilesLoader(array($path)))) 
    118             ->constraintValidatorFactory(new ConstraintValidatorFactory()); 
     117            ->setClassMetadataFactory(new ClassMetadataFactory(new XmlFilesLoader(array($path)))) 
     118            ->setConstraintValidatorFactory(new ConstraintValidatorFactory()); 
    119119 
    120120        $this->assertEquals(new ValidatorFactory($context), $factory); 
     
    128128        $context = new ValidatorContext(); 
    129129        $context 
    130             ->classMetadataFactory(new ClassMetadataFactory(new YamlFilesLoader(array($path)))) 
    131             ->constraintValidatorFactory(new ConstraintValidatorFactory()); 
     130            ->setClassMetadataFactory(new ClassMetadataFactory(new YamlFilesLoader(array($path)))) 
     131            ->setConstraintValidatorFactory(new ConstraintValidatorFactory()); 
    132132 
    133133        $this->assertEquals(new ValidatorFactory($context), $factory); 
     
    141141        $context = new ValidatorContext(); 
    142142        $context 
    143             ->classMetadataFactory(new ClassMetadataFactory(new StaticMethodLoader('loadMetadata'))) 
    144             ->constraintValidatorFactory(new ConstraintValidatorFactory()); 
     143            ->setClassMetadataFactory(new ClassMetadataFactory(new StaticMethodLoader('loadMetadata'))) 
     144            ->setConstraintValidatorFactory(new ConstraintValidatorFactory()); 
    145145 
    146146        $this->assertEquals(new ValidatorFactory($context), $factory); 
     
    165165        $context = new ValidatorContext(); 
    166166        $context 
    167             ->classMetadataFactory(new ClassMetadataFactory($chain)) 
    168             ->constraintValidatorFactory(new ConstraintValidatorFactory()); 
     167            ->setClassMetadataFactory(new ClassMetadataFactory($chain)) 
     168            ->setConstraintValidatorFactory(new ConstraintValidatorFactory()); 
    169169 
    170170        $this->assertEquals(new ValidatorFactory($context), $factory);