PHP Classes

File: vendor/sensio/generator-bundle/Resources/skeleton/crud/actions/edit.php.twig

Recommend this page to a friend!
  Classes of Murat Cileli   Papernic   vendor/sensio/generator-bundle/Resources/skeleton/crud/actions/edit.php.twig   Download  
File: vendor/sensio/generator-bundle/Resources/skeleton/crud/actions/edit.php.twig
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Papernic
Manage documents colaboratively
Author: By
Last change:
Date: 7 years ago
Size: 1,510 bytes
 

Contents

Class file image Download
/** {% block phpdoc_method_header %} * Displays a form to edit an existing {{ entity }} entity. {% endblock phpdoc_method_header %} * {% block phpdoc_method_annotations %} {% if 'annotation' == format %} * @Route("/{id}/edit", name="{{ route_name_prefix }}_edit") * @Method({"GET", "POST"}) {% endif %} {% endblock phpdoc_method_annotations %} */ {% block method_definition %} public function editAction(Request $request, {{ entity_class }} ${{ entity_singularized }}) {% endblock method_definition %} { {% block method_body %} $deleteForm = $this->createDeleteForm(${{ entity_singularized }}); $editForm = $this->createForm('{{ namespace }}\Form\{{ entity_class }}Type', ${{ entity_singularized }}); $editForm->handleRequest($request); if ($editForm->isSubmitted() && $editForm->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist(${{ entity_singularized }}); $em->flush(); return $this->redirectToRoute('{{ route_name_prefix }}_edit', array('id' => ${{ entity_singularized }}->getId())); } {% endblock method_body %} {% block method_return %} return $this->render('{{ entity|lower|replace({'\\': '/'}) }}/edit.html.twig', array( '{{ entity_singularized }}' => ${{ entity_singularized }}, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView(), )); {% endblock method_return %} }