Fosrestbundle: Non-existent service "fos_rest.view_handler"

Created on 21 Feb 2017  路  10Comments  路  Source: FriendsOfSymfony/FOSRestBundle

Hello,

I'm using the dev-master branch and i get this error:

You have requested a non-existent service "fos_rest.view_handler". Did you mean this: "fos_rest.view_handler.default"?

In AppKernel i have declared:

new FOS\RestBundle\FOSRestBundle()

Can someone help me?

Thanks in advance,

Paulo Dias

Most helpful comment

Well, in fact you must nest it under the services key:

services:
  fos_rest.view_handler:
    alias: fos_rest.view_handler.default

All 10 comments

It looks like we should not have merged https://github.com/FriendsOfSymfony/FOSRestBundle/pull/1655 after all... I'll provide a better fix asap.

Any du date for this fix ?
Best regards.

Thank you.

I've done the job with an alias :

services:
    # for bug fix fos rest bundle
    fos_rest.view_handler:
        alias: fos_rest.view_handler.default

InvalidArgumentException in YamlFileLoader.php line 399:
There is no extension able to load the configuration for "fos_rest.view_handler" (in /Resources/config/services.yml). Looked for namespace "fos_rest.view_handler", found none

Did you try my trick ?

This is result of the trick :)
I can get it to work only if I change rest-bundle controller FOSRestController.php
$this->viewhandler = $this->container->get('fos_rest.view_handler');
to
$this->viewhandler = $this->container->get('fos_rest.view_handler.default');
manually

I've just add this "trick" in app/config/service.yml at the top of the document, and don't have any problem.

Well, in fact you must nest it under the services key:

services:
  fos_rest.view_handler:
    alias: fos_rest.view_handler.default

yes, at least 馃憤

I reverted https://github.com/FriendsOfSymfony/FOSRestBundle/pull/1655, it was just a wrong fix... Sorry for this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

feridmovsumov picture feridmovsumov  路  7Comments

maxbeckers picture maxbeckers  路  4Comments

JeroenDeDauw picture JeroenDeDauw  路  6Comments

oliver13 picture oliver13  路  3Comments

dkorsak picture dkorsak  路  5Comments