<?php

namespace {{ namespace }}\Controller{{ entity_namespace ? '\\' ~ entity_namespace : '' }};

{% block use_statements %}
use {{ namespace }}\Entity\{{ entity }};
{% if ('new' in actions or 'edit' in actions) and use_form_type_instance %}
use {{ namespace }}\Form\{{ entity }}Type;
{% endif %}
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
{% if 'annotation' == format -%}
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
{%- endif %}
{% if 'new' in actions or 'edit' in actions or 'delete' in actions %}
use Symfony\Component\HttpFoundation\Request;
{%- endif %}

{% endblock use_statements %}

/**
{% block phpdoc_class_header %}
 * {{ entity_singularized|capitalize }} controller.
{% endblock phpdoc_class_header %}
 *
{% block phpdoc_class_annotations %}
{% if 'annotation' == format %}
 * @Route("{{ route_prefix|default('/') }}")
{% endif %}
{% endblock phpdoc_class_annotations %}
 */
{% block class_definition %}
class {{ entity_class }}Controller extends Controller
{% endblock class_definition %}
{
{% block class_body %}
    {%- if 'index' in actions %}
        {%- include 'crud/actions/index.php.twig' %}
    {%- endif %}

    {%- if 'new' in actions %}
        {%- include 'crud/actions/new.php.twig' %}
    {%- endif %}

    {%- if 'show' in actions %}
        {%- include 'crud/actions/show.php.twig' %}
    {%- endif %}

    {%- if 'edit' in actions %}
        {%- include 'crud/actions/edit.php.twig' %}
    {%- endif %}

    {%- if 'delete' in actions %}
        {%- include 'crud/actions/delete.php.twig' %}
    {%- endif %}
{% endblock class_body %}
}
