<commit_before>
    /**
{% 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")
     * @Template()
{% endif %}
{% endblock phpdoc_method_annotations %}
     */
{% block method_definition %}
    public function editAction($id)
{% endblock method_definition %}
    {
{% block method_body %}
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('{{ bundle }}:{{ entity }}')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find {{ entity }} entity.');
        }

        $editForm = $this->createEditForm($entity);
        $deleteForm = $this->createDeleteForm($id);
{% endblock method_body %}

{% block method_return %}
{% if 'annotation' == format %}
        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
{% else %}
        return $this->render('{{ bundle }}:{{ entity|replace({'\\': '/'}) }}:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
{% endif %}
{% endblock method_return %}
    }

{% block form %}
    /**
    * Creates a form to edit a {{ entity }} entity.
    *
    * @param {{ entity_class }} $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm({{ entity_class }} $entity)
    {
        $form = $this->createForm(new {{ entity_class }}Type(), $entity, array(
            'action' => $this->generateUrl('{{ route_name_prefix }}_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
{% endblock form %}<commit_msg>edit action<commit_after>
    /**
{% 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")
     * @Template()
{% endif %}
{% endblock phpdoc_method_annotations %}
     */
{% block method_definition %}
    public function editAction($id)
{% endblock method_definition %}
    {
{% block method_body %}
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('{{ bundle }}:{{ entity }}')->find($id);

        if (!$entity) {
            $this->get('session')->getFlashBag()->add('error', 'Unable to find {{ entity }} entity.');
            return $this->redirect($this->generateUrl('trunk'));
        }

        $editForm = $this->createEditForm($entity);
{% endblock method_body %}

{% block method_return %}
{% if 'annotation' == format %}
        return array(
            'entity' => $entity,
            'edit_form'  => $editForm->createView()
        );
{% else %}
        return $this->render('{{ bundle }}:{{ entity|replace({'\\': '/'}) }}:edit.html.twig', array(
            'entity' => $entity,
            'edit_form' => $editForm->createView()
        ));
{% endif %}
{% endblock method_return %}
    }

{% block form %}
    /**
    * Creates a form to edit a {{ entity }} entity.
    *
    * @param {{ entity_class }} $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm({{ entity_class }} $entity)
    {
        $form = $this->createForm(new {{ entity_class }}Type(), $entity, array(
            'action' => $this->generateUrl('{{ route_name_prefix }}_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'control', array(
            'back_url' => $this->generateUrl('{{ route_name_prefix }}'),
            'delete_url' => $this->generateUrl('{{ route_name_prefix }}_delete', array('id' => $entity->getId()))
        ));

        return $form;
    }
{% endblock form %}
{'fraction_non_alphanumeric': 0.19347319347319347, 'fraction_numerical': 0.0, 'mean_word_length': 2.6675213675213674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6962911', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1260, 'n_words': 271}