Hello,
what is the correct location for the resource yaml configuration in the symfony 4 flex version?
Hello,
I'm working with AP 2.1.5 and my config files are under src/Resources/config/api_resources
Then you can have a file per entity with the following structure:
# src/Resources/config/api_resources/market.yaml
resources:
App\Entity\Market:
attributes:
pagination_items_per_page: 10
filters:
- name.search_filter
- all_fields.order_filter
properties:
categories:
subresource:
resourceClass: 'App\Entity\MarketCategory'
collection: true
collectionOperations: ~
itemOperations: ~
Notes that all entities namespaces must be under resources key
FML I wrote a big answer to this yesterday...
Oh okay please don't post the same issue in two repositories...
My original answer:
The one you want :).
IMO, standard version would be like:
src/Kernel.php
src/api_resources.yaml
src/Entity/Product.php
With config/packages/api_platform.yaml:
api_platform:
mapping:
paths:
- '%kernel.project_dir%/src/api_resources.yaml'
resource_class_directories:
- '%kernel.project_dir%/src/Entity'
I have the following:
src/Kernel.php
src/Product/api_resources.yaml
src/Product/Entity/Product.php
With config/packages/api_platform.yaml:
api_platform:
mapping:
paths:
- '%kernel.project_dir%/src/Product/api_resources.yaml'
resource_class_directories:
- '%kernel.project_dir%/src/Product/Entity' annotations from those files
https://github.com/api-platform/core/issues/1671#issuecomment-361908539
@soyuka's responses seems the right thing to do, thanks!
If you still have an issue feel free to ping me.
Most helpful comment
FML I wrote a big answer to this yesterday...
Oh okay please don't post the same issue in two repositories...
My original answer:
The one you want :).
IMO, standard version would be like:
With
config/packages/api_platform.yaml:I have the following:
With
config/packages/api_platform.yaml:https://github.com/api-platform/core/issues/1671#issuecomment-361908539