I've updated to Symfony 2.3 and now my RestBundle doesn't work as it did before.
This an example of my code:
$view = View::create()
$context = new SerializationContext();
This did the job, giving me a nice and clean json output.
But now I'm getting that error:
"Template name "" is not valid (format is "bundle:section:template.format.engine").
500 Internal Server Error - InvalidArgumentException"
This is the config:
json: ['application/json; charset=UTF-8', 'application/json']
using these packages:
Any clue what causes this problem? :(
can you pastebin your request on the HTTP level?
My problem might be related. Any help will be greatly appreciated!
Since upgrading to 2.3.2
I managed to resolve mine by setting the listener to false:
the issue is likely not caused by Symfony2.3 but by using the latest master version of FOSRestBundle that switched to a different library for content negotiation
The only issue I can see here is that _format is not handled, but I don't know why. IMO there is nothing wrong except the use of _format itself...
Hello, sorry for the delay.
It was a realy urgent issue in my case. I had to use a backup of an old stage and just updated the serializer packages. So it runs again as it should.
But the issue is still there. What excacly do you mean by "_format is not handled"?
You set prefer_extension to false, so there is no issue here. Look at your Accept header and you will see that rendering html makes the most sense in your case. Turn prefer_extension to true if you want to get JSON again.
Hi I'm sorry could not find some time to set up a playground with the state of the issue. I'm trying but the days still have only 24h :)
@lsmith77 same error with 0.12.0
Then latest master version of FOSRestBundle that switched to a different library for content negotiation does not seem to be the problem at his own
Hope it helps
The issue is the accept header. you must either send application/json; charset=UTF-8 or application/json as the Accept header in your request
Alternatively prefer_extension needs to be enabled and then you can simply add a .json to your route pattern.
OK maybe some cache after modifying the fos rest version in composer.json.
All working as expected.