<?php

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

{% block use_statements %}
{% if 'new' in actions or 'edit' in actions or 'delete' in actions %}
use Symfony\Component\HttpFoundation\Request;
{%- endif %}

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
{% if 'annotation' == format -%}
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
{%- endif %}

use {{ namespace }}\Entity\{{ entity }};
{% if 'new' in actions or 'edit' in actions %}
use {{ namespace }}\Form\{{ entity }}Type;
{% endif %}
{% endblock use_statements %}

/**
{% block phpdoc_class_header %}
 * {{ entity }} controller.
{% endblock phpdoc_class_header %}
 *
{% block phpdoc_class_annotations %}
{% if 'annotation' == format %}
 * @Route("/{{ route_prefix }}")
{% 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/create.php.twig' %}
        {%- 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' %}
        {%- include 'crud/actions/update.php.twig' %}
    {%- endif %}

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