2

I'm trying to include the Symfony Validator Component in our small application. But I can't get it working. I think I put everything together but I always get an Exception.

AnnotationException in AnnotationException.php line 54:
[Semantical Error] The annotation "@Symfony\Component\Validator\Constraints\NotBlank" in property UserEntity ::$username does not exist, or could not be auto-loaded.

But the Class exists and is auto-loaded. I tested it with: AnnotationRegistry::registerLoader().

You can find the Code I'm using here: https://gist.github.com/anonymous/c44fc5a1068b13e9ca22

Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
Skat0r
  • 55
  • 4

1 Answers1

1

It is because of how AnnotationRegistry load classes by namespace.

AnnotationRegistry tries to load .../vendor/symfony/validator/Constraints/Symfony/Component/Validator/Constraints/NotBlank.php, not .../vendor/symfony/validator/Constraints/NotBlank.php. more info

Use AnnotationRegistry::registerLoader()

Community
  • 1
  • 1
Max P.
  • 5,579
  • 2
  • 13
  • 32