{% autoescape false %}
    /**
     * {{ action.description }}
     *
     * @Route("{{ action.route.path }}", name="{{ action.route.name }}")
     * @Method({"{{ action.method }}"})
     */
    public function {{ action.name }}(Request $request, {% for parameter in action.parameters %}${{ parameter }}{% if loop.last == false %}, {% endif %}{% endfor %})
    {
        /* You can provide a _code query parameter to get whatever response code you want */
{% for response in action.responses %}
        if ({{ response.code }} == $this->get('request')->query->get('_code', null)) {
{% include 'response.php.twig' with { 'response' : response } %}
        }
{% endfor %}
        /* If your api doesn't handle the requested response code, the first response available is returned */
{% include 'response.php.twig' with { 'response' : action.responses[0] } %}
    }

{% endautoescape %}

{% autoescape false %}
    /**
     * {{ action.description }}
     *
     * @Route("{{ action.route.path }}", name="{{ action.route.name }}")
     * @Method({"{{ action.method }}"})
     */
    public function {{ action.name }}(Request $request{% for parameter in action.parameters %}, ${{ parameter }}{% endfor %})
    {
        /* You can provide a _code query parameter to get whatever response code you want */
{% for response in action.responses %}
        if ({{ response.code }} == $this->get('request')->query->get('_code', null)) {
{% include 'response.php.twig' with { 'response' : response } %}
        }
{% endfor %}
        /* If your api doesn't handle the requested response code, the first response available is returned */
{% include 'response.php.twig' with { 'response' : action.responses[0] } %}
    }

{% endautoescape %}

Remove unexpected comma when no parameters in action.
Remove unexpected comma when no parameters in action.
