original_string: public function createAction(Request $request, $postid)
      {
          $post = $this->getPost($postid);
  
          $entity = new Comment();
          $entity->setPost($post);
          $entity->setAuthor($this->getCurrentAuthor());
          $form   = $this->createForm(new CommentType(), $entity);
          $form->bind($request);
  
          if ($form->isValid()) {
              $em = $this->getDoctrine()->getManager();
              $em->persist($entity);
              $em->flush();
  
              $this->getSession()->getFlashBag()->set('success', 'The comment has been created successfully.');
  
              return $this->redirect($this->generateUrl('page_or_post', array('slug' => $post->getSlug())));
          }
  
          return array(
              'entity' => $entity,
              'post'   => $post,
              'form'   => $form->createView(),
          );
      }
code: public function createAction(Request $request, $postid)
      {
          $post = $this->getPost($postid);
  
          $entity = new Comment();
          $entity->setPost($post);
          $entity->setAuthor($this->getCurrentAuthor());
          $form   = $this->createForm(new CommentType(), $entity);
          $form->bind($request);
  
          if ($form->isValid()) {
              $em = $this->getDoctrine()->getManager();
              $em->persist($entity);
              $em->flush();
  
              $this->getSession()->getFlashBag()->set('success', 'The comment has been created successfully.');
  
              return $this->redirect($this->generateUrl('page_or_post', array('slug' => $post->getSlug())));
          }
  
          return array(
              'entity' => $entity,
              'post'   => $post,
              'form'   => $form->createView(),
          );
      }
code_tokens: public function createAction ( Request $ request , $ postid ) { $ post = $ this -> getPost ( $ postid ) ; $ entity = new Comment ( ) ; $ entity -> setPost ( $ post ) ; $ entity -> setAuthor ( $ this -> getCurrentAuthor ( ) ) ; $ form = $ this -> createForm ( new CommentType ( ) , $ entity ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; $ this -> getSession ( ) -> getFlashBag ( ) -> set ( 'success' , 'The comment has been created successfully.' ) ; return $ this -> redirect ( $ this -> generateUrl ( 'page_or_post' , array ( 'slug' => $ post -> getSlug ( ) ) ) ) ; } return array ( 'entity' => $ entity , 'post' => $ post , 'form' => $ form -> createView ( ) , ) ; }
docstring: Creates a new Comment entity.
  
  @Route("/create", name="post_comment_create")
  @Secure("ROLE_COMMENT_WRITE")
  @Method("POST")
  @Template("VeonikBlogBundle:Comment:new.html.twig")
docstring_tokens: Creates a new Comment entity .