2

Im stay a few days with this problem. I just read the documentation of this Bundle, but im trying all and nothing work.

The problem is always: No route found for "GET /produtos". Im only want a make HTTP get,new,post,put,delete work in html.twig .

This is my controller with my function:

public function cgetAction() {
    $em = $this->getDoctrine()->getManager();
    $data = $em->getRepository('ModelBundle:Produto')->findAll();

    $view = $this->view($data, 200)
        ->setTemplate("ModelBundle:produto:getProdutos.html.twig")
        ->setTemplateVar('produto')
    ;

    return $this->handleView($view);
} // "get_users"     [GET] /users

And this my config.yml(FOSRestBundle already installed), configuration of FOSRestBundle:

fos_rest:
    allowed_methods_listener: true
    view:
        formats:
            rss: true
            xml: false
        templating_formats:
            html: true
        force_redirects:
            html: true
        failed_validation: HTTP_BAD_REQUEST
        default_engine: twig
    routing_loader:
        default_format: json 

This is routing.yml

produtos:
    type:     rest
    resource: "@ModelBundle\Controller\ProdutosController"

my debug:router is not showing a route. help me please guys thanks

lordrhodos
  • 2,689
  • 1
  • 24
  • 37
  • does your controller implement `ClassResourceInterface` as [described in the docs](https://symfony.com/doc/current/bundles/FOSRestBundle/5-automatic-route-generation_single-restful-controller.html#implicit-resource-name-definition)? – lordrhodos Jun 23 '17 at 07:58

0 Answers0