FOSRestBundle + Symfony 3.4 : rest type not reconized

寵の児 提交于 2019-12-24 09:26:45

问题


I'm using Symfony 3.4 with FOSUserBundle, I have imported my project from Symfony 3.3, and now, I have an error :

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.

Here my config/routes.yaml file :

# Some routes...

# Api rest
api:
    type:     rest
    resource: "api.yaml"
    prefix: /api

And my file 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_

The FOSRestBundle is enabled with the following line in Bundle.php :

FOS\RestBundle\FOSRestBundle::class => ["all" => true]

回答1:


This was an issue with moving from .yml to .yaml the fix has been merged but the new version hasn't been released yet, can you try and require branch 2.3-dev, that should fix your issue.



来源:https://stackoverflow.com/questions/48470527/fosrestbundle-symfony-3-4-rest-type-not-reconized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!