FOSRestBundle icon indicating copy to clipboard operation
FOSRestBundle copied to clipboard

Override ViewHandler

Open emulienfou opened this issue 7 years ago • 0 comments

Hello there, I'm using FOSCommentBundle under Symfony 4.1 who use FOSRestBundle and I'm trying to override the FOS\RestBundle\View\ViewHandler class.
However I think there is something missing because I've got the next error: Format 'html' not supported, handler must be implemented!

Here is my class:

<?php
namespace Acme\Rest;
class ViewHandler extends \FOS\RestBundle\View\ViewHandler { }

And here is my service declaration:

Acme\Rest\ViewHandler:
    arguments: ['@fos_rest.router', '@fos_rest.serializer', '@?fos_rest.templating', '@request_stack']
    public: true

And calling my service like:

$this->container->get('Acme\Rest\ViewHandler');

However, when I use the service fos_rest.view_handler, I do not have this issue, only when using my own service!

Did I need to do something else when declaring my service?

Thanks

emulienfou avatar Jul 13 '18 13:07 emulienfou