A
A
Alexander892015-12-07 23:01:13
symfony
Alexander89, 2015-12-07 23:01:13

No converter named 'fos_rest.request_body' What's the problem?

I want to receive an object at the input of the method, but the exception takes off
No converter named 'fos_rest.request_body' found for conversion of parameter 'article'.
What is the problem? Do I need to describe the converter somewhere?
Controller code

<?php
namespace MyBundle\Controller\API\V1;

class OrganizationController extends FOSRestController
{
    /**
     * @param Article $article
     * @return Response
     * @ParamConverter("article", converter="fos_rest.request_body")
     */
    public function postDTOAction(Article $article = null)
    {
    }
}

config.yml
#Sensio ExtraBundle
sensio_framework_extra:
    router:      { annotations: false }
    request:     { converters: true, auto_convert: true }
    view:        { annotations: false }
    cache:       { annotations: false }
    security:    { annotations: true }
    psr_message: { enabled: false } # Defaults to true if the PSR-7 bridge is installed

#FOSRestBundle
fos_rest:
    param_fetcher_listener: true
    body_listener: true
    format_listener: true
    view:
        view_response_listener: 'force'
        formats:
            json : true
        templating_formats:
            html: false
        force_redirects:
            html: true
        failed_validation: HTTP_BAD_REQUEST
        default_engine: twig

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question