disableAttributeMapping example

/** * @group legacy */
    public function testExpectDeprecationWhenDisablingAnnotationMapping()
    {
        $this->expectDeprecation('Since symfony/validator 6.4: Method "Symfony\Component\Validator\ValidatorBuilder::disableAnnotationMapping()" is deprecated, use "disableAttributeMapping()" instead.');
        $this->assertSame($this->builder, $this->builder->disableAnnotationMapping());
    }

    public function testDisableAttributeMapping()
    {
        $this->assertSame($this->builder, $this->builder->disableAttributeMapping());
    }

    public function testSetMappingCache()
    {
        $this->assertSame($this->builder, $this->builder->setMappingCache($this->createMock(CacheItemPoolInterface::class)));
    }

    public function testSetConstraintValidatorFactory()
    {
        $this->assertSame($this->builder, $this->builder->setConstraintValidatorFactory(
            $this->createMock(ConstraintValidatorFactoryInterface::class))
        );


    /** * @deprecated since Symfony 6.4, use "disableAttributeMapping()" instead * * @return $this */
    public function disableAnnotationMapping()static
    {
        trigger_deprecation('symfony/validator', '6.4', 'Method "%s()" is deprecated, use "disableAttributeMapping()" instead.', __METHOD__);

        return $this->disableAttributeMapping();
    }

    /** * Disables attribute-based constraint mapping. * * @return $this */
    public function disableAttributeMapping()static
    {
        $this->annotationReader = null;
        $this->enableAttributeMapping = false;

        
Home | Imprint | This part of the site doesn't use cookies.