Search code examples
phpsymfonyfosrestbundle

FOSRestBundle + Symfony 3.4 : rest type not reconized


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]

Solution

  • 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.