Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator AnnotationLoader needs configuring before annotation classes can be loaded #9067

Closed
jxmallett opened this issue Jan 17, 2018 · 3 comments
Assignees

Comments

@jxmallett
Copy link
Contributor

I'm using the Validator as a stand-alone component (ie I'm not using the full Symfony framework).

On the Loading Resources page it says I can use Annotation mapping by simply calling enableAnnotationMapping().

I was getting an error The annotation "@Symfony\Component\Validator\Constraints\NotBlank" in property MyClasss::$myProperty does not exist, or could not be auto-loaded.

I tried adding the telling the registry about the Symfony\Component\Validator\Constraints namespace and directory but had no luck as it looks for $dir/Symfony/Component/Validator/Constraints/NotBlank.php instead of $dir/NotBlank.php.

I ended up telling the AnnotationRegistry about my autoloaders:

foreach (spl_autoload_functions() as $autoloader) {
    \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader($autoloader);
}

Should this be added to the documentation or am I doing something wrong?

@carsonbot
Copy link
Collaborator

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link
Collaborator

Friendly reminder that this issue exists. If I don't hear anything I'll close this.

@carsonbot
Copy link
Collaborator

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants