Canser Yanbakan
Canser Yanbakan

Reputation: 3870

Cannot import resource error, FosRestBundle Throws InvalidArgumentException

Hello i have a strange problem, while using FostRestBundle.

First error is :

InvalidArgumentException: Every parent controller must have get{SINGULAR}Action($id) method where {SINGULAR} is a singular form of associated object

And the second one :

Cannot import resource "/home/a15net/public_html/game/src/ATL/ContentBundle/Resources/config/api_routing.yml" from "/home/a15net/public_html/game/app/config/routing.yml".

I'v checked my all "YAML" files but there was no indent problems.

Tried to update composer twice nothing helped.

Edit : Config.yml > http://goo.gl/dqCAu

Upvotes: 0

Views: 610

Answers (2)

Canser Yanbakan
Canser Yanbakan

Reputation: 3870

--- NOT --- SOLUTION :

If a route has a parent route, you must not put "type:rest" to it. You have to use "type:rest" only in parent routes.

Sample :

catalogs:
    type: rest
    prefix: api
    resource: ATL\CatalogBundle\Controller\API\CatalogsController
    options:
        expose: true
taxonomy:
    parent: catalogs
    resource: ATL\CatalogBundle\Controller\API\TaxonomyController
    options:
        expose: true 

I will not choose this as correct answer until more comments and other solution suggestions writed.

Edit

When you remove type:rest from children route, it is not a rest route anymore.

Upvotes: 0

Nisam
Nisam

Reputation: 2285

You have to remove the 'type' from this import statement fro your routing.yml

atl_content_api:
    resource: "@ATLContentBundle/Resources/config/api_routing.yml"

Inside the api_routing.yml you can specify the rest type for each controller like,

acme_user_rest:
    resource: Acme\UserBundle\Controller\UserRestController
    prefix: /api
    type: rest

this blog will help you to implement the sme

Upvotes: 1

Related Questions