3

Return sfView::NONE in Symfony2

Posted February 20th, 2011 in Razno and tagged , , by Metod

In Symfony 1.x if you wanted to output some text or json or something else and not use a template for that action you would just do the following:

However, in Symfony2 that isn’t working anymore. Every action must return a response, so you can do the following:

3 Responses so far.

  1. tirengarfio says:

    Thanks, but I’m getting this error when I call the action:

    You have requested a non-existent service “response”.

    Javi

  2. Metod says:

    Yes, some things changed from beta version of Symfony2. I updated the code to fit the new stable version.

  3. CAP says:

    Cool 🙂