0

app/console router:debug shows

get_test_helloworld      GET    /test/helloworld.{_format}

but on hitting this url, nothing is displayed and in logs i get

    [2013-06-08 02:38:44] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException:
No route found for "GET /test/helloworld" (uncaught exception) 
at /home/user/Code/app/cache/prod/classes.php line 4261 [] []

My TestController

<?php

namespace User\Bundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FOS\RestBundle\View\View;
use FOS\RestBundle\Response\Codes;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

class TestController extends Controller
{
    public function getTestHelloworldAction()
    {
        var_dump('hello world');die;
    }
}

I am using FosRest bundle and routing.yml have

test:
    type: rest
    resource: User\Bundle\Controller\TestController

Stuck here from long time now. Any ideas where is this going wrong?

amitchhajer
  • 12,492
  • 6
  • 40
  • 53

2 Answers2

2

Clear the cache and restart server and php. Hope this helps.

0

The problem that you don't have /test/helloworld route, you have only test/helloworld.html cause for format, html is the default value, id you doesn't specify otherwise. If you want to test for AJAX calls (eg format with json ) AND normal request then leave it like this, but if you will use only with html format, remove the .{_format}, cause then you don't need it.

ghostika
  • 1,473
  • 1
  • 12
  • 23
  • i don't want html format, leaving like this is giving 500 so far – amitchhajer Jun 08 '13 at 06:31
  • This is what i'm saying, cause you call a not existing url. Remove from the patter the '.{_format}' part and it will work or call /test/helloworld.json – ghostika Jun 08 '13 at 08:59