Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : "You must enable the SensioFrameworkExtraBundle view annotations" #1846

Closed
LMO-NEO opened this issue Jan 18, 2018 · 9 comments
Closed

Comments

@LMO-NEO
Copy link

LMO-NEO commented Jan 18, 2018

Hello,

I use Symfony 2.8 with FOSRestBundle 1.8, (i can't update, this is fixed because i am in a collab work).

I have this error when i call a controller method that returns a view Response (by View::create($data)) :
RuntimeException in ConfigurationCheckPass.php line 34:
You must enable the SensioFrameworkExtraBundle view annotations to use the ViewResponseListener.

I read all issues concerning configuration of the bundle and problems with FrameworkExtraBundle, but no solution work for me ...

In my config.yml file, i have :

# fos_rest configuration
fos_rest:
    param_fetcher_listener: true
    body_listener: true
    format_listener: true
    view:
        view_response_listener: 'force'
        formats:
            xml: true
            json : true
        templating_formats:
            html: true
        force_redirects:
            html: true
        failed_validation: HTTP_BAD_REQUEST
    routing_loader:
        default_format: json
        include_format: false
sensio_framework_extra:
    view: { annotations: false }

Thanks for your help :)

@xabbuh
Copy link
Member

xabbuh commented Jan 18, 2018

Does it change anything if you change the config for SensioFrameworkExtraBundle to something like this:

sensio_framework_extra:
    view: { annotations: true }

@LMO-NEO
Copy link
Author

LMO-NEO commented Jan 18, 2018

Yes, il already tried this, and it throw this error :
Attempted to call an undefined method named "getTemplate" of class "Symfony\Bundle\FrameworkBundle\Templating\TemplateReference".
Stack Trace
in vendor\friendsofsymfony\rest-bundle\EventListener\ViewResponseListener.php at line 119 -
$view->setData($parameters);
}
if ($configuration && ($template = $configuration->getTemplate()) && !$view->getTemplate()) {
if ($template instanceof TemplateReferenceInterface) {
$template->set('format', null);
}
at ViewResponseListener ->onKernelView ()

This is the first error i had since the beginning.

@xabbuh
Copy link
Member

xabbuh commented Jan 18, 2018

You probably also need to install and enable the TwigBundle.

@LMO-NEO
Copy link
Author

LMO-NEO commented Jan 18, 2018

TwigBundle is already installed, but i don't think the problem comes form Twig itself ...
Do you have others ideas or things that i can check to continue debug ?

@Oviglo
Copy link

Oviglo commented Feb 21, 2018

+1 I have this error too

@xabbuh
Copy link
Member

xabbuh commented Feb 22, 2018

Can you try the latest master? If that still does not work, are you able to create a small project that allows to reproduce the issue?

@oliverklee
Copy link

#1878 might be related.

@LMO-NEO
Copy link
Author

LMO-NEO commented Mar 8, 2018

Hello,
I don't know how, but today it works ... I have not changed anything in a long time.
Thanks anyway for your answers ;)

@xabbuh
Copy link
Member

xabbuh commented Mar 8, 2018

Thanks for the feedback. Closing here then.

@xabbuh xabbuh closed this as completed Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants