code: public function editAction(Request $request, Category $category)
      {
          $deleteForm = $this->createDeleteForm($category);
          $editForm = $this->createForm('BlogBundle\Form\CategoryType', $category);
          $editForm->handleRequest($request);
  
          if ($editForm->isSubmitted() && $editForm->isValid()) {
              $em = $this->getDoctrine()->getManager();
              $em->persist($category);
              $em->flush();
  
              $this->get('session')->getFlashBag()->add('success', 'category.edited');
              
              return $this->redirectToRoute('blog_category_index');
          }
  
          return array(
              'entity' => $category,
              'edit_form' => $editForm->createView(),
              'delete_form' => $deleteForm->createView(),
          );
      }
docs: Displays a form to edit an existing Category entity.
  
  @Route("/{id}/edit")
  @Method({"GET", "POST"})
  @Template()