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

Vendor classes loaded but they shouldn't #248

Open
kaiwa opened this issue Apr 6, 2016 · 3 comments
Open

Vendor classes loaded but they shouldn't #248

kaiwa opened this issue Apr 6, 2016 · 3 comments

Comments

@kaiwa
Copy link

kaiwa commented Apr 6, 2016

Hi,

not sure if this is a bug or a configuration problem on my side.

When using SonataUserBundle and JMSDiExtraBundle, Sonata's code triggers an annotation exception (because of a missing optional dependency only needed if the api controllers are used).

  [Doctrine\Common\Annotations\AnnotationException]                                                                                                                                                    
  [Semantical Error] The annotation "@Nelmio\ApiDocBundle\Annotation\ApiDoc" in method Sonata\UserBundle\Controller\Api\UserController::getUsersAction() does not exist, or could not be auto-loaded.

The routing for those api controllers is added optionally by SonataUserBundle, depending on if some other bundles are available. But SonataUserBundle is definitely not loading the api controllers by itself in this case.

Somehow JMSDiExtraBundle seems to cause their api controllers to load, despite I have configured:

jms_di_extra:
    locations:
         all_bundles: false

Is there anything else to configure so that DiExtraBundle does not cause loading other vendor classes?

I have set up a minimal project here for demonstrating the issue.

@covex-nn
Copy link

covex-nn commented Jul 9, 2016

This happening here:

Cache warmer try to find all controllers in all bundles. After this it create injector for every controller class, including controllers with @Nelmio\ApiDocBundle\Annotation\ApiDoc annotation.

@kaiwa
Copy link
Author

kaiwa commented Jul 9, 2016

Good spot @covex-nn ! Thank you.

So there is at least a possible workaround by adding the affected controllers to

jms_di_extra.cache_warmer.controller_file_blacklist

@covex-nn
Copy link

I think i have found a problem. And it is not possible to ignore @apidoc annotation right now: doctrine/annotations package does not allow to ignore valid annotations =(

Also i have found PR in doctrine/annotations repo: DocParser can now ignore whole namespaces. But in that PR @BreiteSeite tried to ignore non-valid annotations. So, it will not help to solve this problem yet.

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

No branches or pull requests

2 participants