Hi,
I just upgraded to dev-master. However, now calls to the Dunglas API return Format 'html' not supported, handler must be implemented. Was there a change which caused this, or is this because I removed NelmioApiDocBundle from my project (which didn't work with dev-master)?
The backtrace shows that this exception is created by FOS\RestBundle\View\ViewHandler. Could this be an interoperability issue in conjunction with the FOSRestBundle?
thanks
Felicitus
Did you set the view_response_listener to force ?
fos_rest:
view:
view_response_listener: 'force'
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/832d08199cadf1770ec43c2cba68b42b4d5e7f9f/EventListener/ViewResponseListener.php#L73-L80
Try to set it to true in order to let other view listeners try to do their job when the _view attribute does not exist.
Yes, my config includes view_response_listener:
fos_rest:
body_listener: true
format_listener: true
param_fetcher_listener: force
format_listener:
rules:
- priorities: [json, xml]
- fallback_format: json
view:
exception_wrapper_handler: PartKeepr\DoctrineReflectionBundle\Exception\ExceptionWrapperHandler
default_engine: php
formats:
json: true
xml: true
templating_formats:
html: false
view_response_listener: force
I'm currently stepping through the debugger, but any hints where the problem could be caused are appreciated!
What happen if you set :
fos_rest:
body_listener: true
format_listener: true
param_fetcher_listener: force
format_listener:
rules:
- priorities: [json, xml]
- fallback_format: json
view:
exception_wrapper_handler: PartKeepr\DoctrineReflectionBundle\Exception\ExceptionWrapperHandler
default_engine: php
formats:
json: true
xml: true
templating_formats:
html: false
- view_response_listener: force
+ view_response_listener: true
??
Wow, thank you, this works now! Sorry I didn't read your answer as carefully as I should have. I'm not sure why it was set to force in the first place.
I solved this issue by using a pattern to restrict FOSRestBundle to only relevant URLS:
fos_rest:
# …
# Do not interfer with API Platform
zone:
- { path: ^/FOS_REST_PREFIX/api/* }
Most helpful comment
What happen if you set :
??