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

Problems with bundles that have Entity folder #1655

Closed
giovannialbero1992 opened this issue Jan 16, 2018 · 5 comments
Closed

Problems with bundles that have Entity folder #1655

giovannialbero1992 opened this issue Jan 16, 2018 · 5 comments

Comments

@giovannialbero1992
Copy link

giovannialbero1992 commented Jan 16, 2018

I've noticed that api-platform scans all bundles into vendor directory, this behaviour creates problem when i use api-platform and vich-uploader without ORM installed in my project (for example).
Is there a config to avoid this behaviour? I'd like to evaluate only folders declared into api_platform.yml

api_platform:
    mapping:
        paths: ['%kernel.project_dir%/src/Document'] 
@jewome62
Copy link
Contributor

You should override api_platform.resource_class_directories
I dont know if you can just add into Yaml config or if you must override by compiler

@giovannialbero1992
Copy link
Author

i must override entire api_platform.resource_class_directories in compiler pass . It would be nice have a config that disable this behaviour. is it welcome a PR on this?

@jewome62
Copy link
Contributor

Everything is welcome in PR if the request makes sense

@soyuka
Copy link
Member

soyuka commented Jan 25, 2018

So I came across the same problem.

An alternative solution is to patch configureContainer of your Kernel to add the missing paths. Indeed, we currently search for $bundle['path']/Entity.

I'll add a patch to help configure resource_class_directories it'll give more power to the developer IMO. For example:

api_platform:
    mapping:
        paths:
          - '%kernel.project_dir%/src/Foo/api_resources.yaml'
    resource_class_directories:
        - '%kernel.project_dir%/src/Foo/Entity'

@soyuka
Copy link
Member

soyuka commented Jan 29, 2018

Doc PR: api-platform/docs#380
Closing.

@soyuka soyuka closed this as completed Jan 29, 2018
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

3 participants