FOSRestBundle + Symfony 3.4:无法识别休息类型
FOSRestBundle + Symfony 3.4 : rest type not reconized
我正在使用带有 FOSUserBundle 的 Symfony 3.4,我已经从 Symfony 3.3 导入了我的项目,现在,我有一个错误:
Class could not be determined for Controller identified by "api.yaml"
in api.yaml (which is being imported from
"/home/user/project/config/routes.yaml"). Make sure there is a loa
der supporting the "rest" type.
这是我的 config/routes.yaml 文件:
# Some routes...
# Api rest
api:
type: rest
resource: "api.yaml"
prefix: /api
还有我的文件 config/api.yaml :
rest.media:
type: rest
resource: App\Controller\REST\MediaApi
name_prefix: api_rest_media_
rest.feeds:
type: rest
resource: App\Controller\REST\FeedsApi
name_prefix: api_rest_media_feeds_
rest.media.indexers:
type: rest
resource: App\Controller\REST\IndexersApi
name_prefix: api_rest_media_indexers_
FOSRestBundle 在 Bundle.php 中使用以下行启用:
FOS\RestBundle\FOSRestBundle::class => ["all" => true]
这是从 .yml
移动到 .yaml
的问题,修复已合并,但新版本尚未发布,您可以尝试要求分支 2.3-dev
,这应该可以解决您的问题。
我正在使用带有 FOSUserBundle 的 Symfony 3.4,我已经从 Symfony 3.3 导入了我的项目,现在,我有一个错误:
Class could not be determined for Controller identified by "api.yaml" in api.yaml (which is being imported from "/home/user/project/config/routes.yaml"). Make sure there is a loa
der supporting the "rest" type.
这是我的 config/routes.yaml 文件:
# Some routes...
# Api rest
api:
type: rest
resource: "api.yaml"
prefix: /api
还有我的文件 config/api.yaml :
rest.media:
type: rest
resource: App\Controller\REST\MediaApi
name_prefix: api_rest_media_
rest.feeds:
type: rest
resource: App\Controller\REST\FeedsApi
name_prefix: api_rest_media_feeds_
rest.media.indexers:
type: rest
resource: App\Controller\REST\IndexersApi
name_prefix: api_rest_media_indexers_
FOSRestBundle 在 Bundle.php 中使用以下行启用:
FOS\RestBundle\FOSRestBundle::class => ["all" => true]
这是从 .yml
移动到 .yaml
的问题,修复已合并,但新版本尚未发布,您可以尝试要求分支 2.3-dev
,这应该可以解决您的问题。