sterntours/vendor/sensio/generator-bundle/Resources/skeleton/controller/Controller.php.twig
2020-07-09 12:49:32 +02:00

42 lines
1.1 KiB
Twig

<?php
namespace {{ namespace }}\Controller;
{% block use_statements %}
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
{% if 'annotation' == format.routing -%}
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
{% endif %}
{% endblock use_statements %}
{% block class_definition %}
class {{ controller }}Controller extends Controller
{% endblock class_definition %}
{
{% block class_body %}
{% for action in actions %}
{% if 'annotation' == format.routing -%}
/**
* @Route("{{ action.route }}")
*/
{% endif -%}
public function {{ action.name }}(
{%- if action.placeholders|length > 0 -%}
${{- action.placeholders|join(', $') -}}
{%- endif -%})
{
{% if 'default' == action.template -%}
return $this->render('{{ bundle }}:{{ controller }}:{{ action.name|slice(0, -6) }}.html.{{ format.templating }}', array(
// ...
));
{%- else -%}
return $this->render('{{ action.template }}', array(
// ...
));
{%- endif %}
}
{% endfor -%}
{% endblock class_body %}
}