Reputation: 21
I installed the two libraries FOSRest and Sensio but I have the following error:
You must enable the SensioFrameworkExtraBundle view annotations to use the ViewResponseListener. Did you forget to install and enable the TwigBundle?
While I do not need Twig since my API will send everything back to json.
I still try to install it but I still have problems.
Here is the configuration for Sensio:
sensio_framework_extra:
router:
annotations: false
view:
annotations: true
request:
converters: true
And for FOSREST:
fos_rest:
body_converter:
enabled: true
serializer:
serialize_null: true
view:
formats: { json: true, xml: false, rss: false }
view_response_listener: true
format_listener:
rules:
- { path: '^/', priorities: ['json'], fallback_format: 'json' }
Nothing very important.
I hope you can help me.
Thanking you
Upvotes: 1
Views: 279
Reputation: 212
While this is not the most satisfying solution, I ended up installing TwigBundle after a very frustrating hour, just as suggested by the message.
composer require symfony/twig-bundle
This should solve your error.
I say this is not the most satisfying solution because just like you I did not need Twig templating at all so it didn't feel natural to install it. I couldn't take much time to figure out why FOSRest would need this. Does it rely on some Twig code bricks to run? I don't know, this is just the best and quicker workaround I found.
Upvotes: 1