I have a simple crud controller generate by doctrine
<?php
namespace MyBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use MyBundle\Entity\MyEntity;
use MyBundle\Form\MyEntityType;
/**
* PsaEventualidadContrato controller.
*
* @Route("/my")
*/
class MyController extends Controller
{
//...
/**
* Displays a form to create a new MyEntity entity.
*
* @Route("/new.{_format}", name="my_new", defaults={"_format"="json"})
* @Method("GET")
* @Template()
*/
public function newAction()
{
$entity = new MyEntity();
$form = $this->createCreateForm($entity);
return array(
'entity' => $entity,
'form' => $form->createView(),
);
}
//...
}
when i go to http://myhost/app_dev.php/my/new.json
in dev.log
i can see
[2013-09-28 11:29:13] request.INFO: Matched route "eventualidad_new" (parameters: "_format": "json", "_controller": "MyBundle\Controller\MyController::newAction", "_route": "my_new") [] []
but the browser renders the html template. why this happens?
I'm using Symfony v2.3.4
and v2.3.5