src/PHPDish/Bundle/ForumBundle/Controller/TopicController.php
public function editAction($id, Request $request)
    {
        $topic = $this->getTopicManager()->findTopicById($id);
        if (!$topic) {
            throw $this->createNotFoundException();
        }
        $this->denyAccessUnlessGranted('edit', $topic);

        $form = $this->createForm(TopicType::class, $topic);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $this->getTopicManager()->saveTopic($topic);

            return $this->redirectToRoute('topic_view', [
                'id' => $topic->getId(),
            ]);
        }

        return $this->render($this->configuration->getTemplate('Topic:create.html.twig'), [
            'form' => $form->createView(),
            'topic' => $topic,
            'threads' => $this->getThreadManager()->findEnabledThreads(10)
        ]);
    }
public function editAction($id, Request $request)
    {
        $topic = $this->getTopicManager()->findTopicById($id);
        if (!$topic) {
            throw $this->createNotFoundException();
        }
        $this->denyAccessUnlessGranted('edit', $topic);

        $form = $this->createForm(TopicType::class, $topic);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $this->getTopicManager()->saveTopic($topic);

            return $this->redirectToRoute('topic_view', [
                'id' => $topic->getId(),
            ]);
        }

        return $this->render($this->configuration->getTemplate('Topic:create.html.twig'), [
            'form' => $form->createView(),
            'topic' => $topic,
            'threads' => $this->getThreadManager()->findEnabledThreads(10)
        ]);
    }
修改话题.

@Route("/topics/{id}/edit", name="topic_edit", requirements={"id": "\d+"})

@param int     $id
@param Request $request

@return Response