DoctrineLoaderEnum example



    public function testExtractEnum()
    {
        $validator = Validation::createValidatorBuilder()
            ->addMethodMapping('loadValidatorMetadata')
            ->enableAttributeMapping()
            ->addLoader(new DoctrineLoader(DoctrineTestHelper::createTestEntityManager(), '{^Symfony\\\\Bridge\\\\Doctrine\\\\Tests\\\\Fixtures\\\\DoctrineLoader}'))
            ->getValidator()
        ;

        $classMetadata = $validator->getMetadataFor(new DoctrineLoaderEnum());

        $enumStringMetadata = $classMetadata->getPropertyMetadata('enumString');
        $this->assertCount(0, $enumStringMetadata); // asserts the length constraint is not added to an enum
        $enumStringMetadata = $classMetadata->getPropertyMetadata('enumInt');
        $this->assertCount(0, $enumStringMetadata); // asserts the length constraint is not added to an enum     }

    public function testFieldMappingsConfiguration()
    {
        $validator = Validation::createValidatorBuilder()
            
Home | Imprint | This part of the site doesn't use cookies.