getId() публичный Метод

public getId ( )
Пример #1
0
 /**
  * @Security("has_role('ROLE_OKTOLAB_USER')")
  * @Route("/answer/{comment}", name="oktothek_answer_comment")
  * @Template()
  */
 public function answerCommentAction(Request $request, Comment $comment)
 {
     $answer = new Comment();
     $commentForm = $this->createForm(CommentType::class, $answer, ['action' => $this->generateUrl('oktothek_answer_comment', ['comment' => $comment->getId()])]);
     $commentForm->add('submit', SubmitType::class, ['label' => 'oktothek.comment_reply_button', 'attr' => ['class' => 'btn btn-primary']]);
     if ($request->getMethod() == "POST") {
         $commentForm->handleRequest($request);
         if ($commentForm->isValid()) {
             $answer->setUser($this->get('security.context')->getToken()->getUser());
             $answer->setReferer($comment->getReferer());
             $answer->setParent($comment);
             $comment->addChild($answer);
             $em = $this->getDoctrine()->getManager();
             $em->persist($comment);
             $em->persist($answer);
             $em->flush();
             $this->get('session')->getFlashBag()->add('success', 'oktothek.comment_create_success');
             return $this->redirect($request->headers->get('referer'));
         }
         $this->get('session')->getFlashBag()->add('error', 'oktothek.comment_create_error');
     }
     return ['commentForm' => $commentForm->createView()];
 }
Пример #2
0
 /**
  * Creates a form to delete a Comment entity.
  *
  * @param Comment $comment The Comment entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Comment $comment)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('admin_comment_delete', array('id' => $comment->getId())))->setMethod('DELETE')->add('submit', SubmitType::class, ['label' => ' ', 'attr' => ['class' => 'glyphicon glyphicon-trash btn-link']])->getForm();
 }
Пример #3
0
 public function createPostCommentDeleteForm(Comment $comment)
 {
     //$builder = $this->formFactory->createBuilder();
     $form = $this->builder->setAction($this->router->generate('remove_post_comment', array('id' => $comment->getId())))->setMethod('DELETE')->add('submit', SubmitType::class, ['label' => ' ', 'attr' => ['class' => 'glyphicon glyphicon-trash btn-link']])->getForm();
     return $form;
 }
 /**
  * Creates a form to delete a Comment entity.
  *
  * @param Comment $comment The Comment entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Comment $comment)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('comment_delete', array('id' => $comment->getId())))->setMethod('DELETE')->getForm();
 }
 /**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }