如何在 api-platform 中为不同的 bundle 配置不同的前缀
问题描述:
控制台命令 debug:router
绝对显示所有资源,来自所有已安装的 Bundle(实体标记为 @ApiResource())
Console command debug:router
show absolutely ALL resources, from all installed Bundles (entity marked with @ApiResource())
如何为不同的bundle配置不同的前缀?或者有选择地禁用资源.
How to configure different prefixes for different bundles? Or selectively disable resources.
App 忽略了 resource
中的任何路径:config/routes/api_platform.yaml
App ignored any path in resource
: config/routes/api_platform.yaml
api_platform:
resource: .
type: api_platform
prefix: /api
使用默认配置 config/packages/api_platform.yaml
api_platform:
mapping:
paths: ['%kernel.project_dir%/src/Entity']
答
对于 type: api_platform
resource: .
not used
For type: api_platform
resource: .
not used
自动资源加载只能完全禁用
Automatic resource loading can only be disabled completely
doctrine:
enabled: false