本文整理汇总了PHP中AppBundle\Entity\Post::setIdTematu方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::setIdTematu方法的具体用法?PHP Post::setIdTematu怎么用?PHP Post::setIdTematu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\Post
的用法示例。
在下文中一共展示了Post::setIdTematu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPostAction
/**
* @Route("{page}/temat/{temat}")
*/
public function addPostAction(Request $request, $temat, $page)
{
if ($this->getUser() == true) {
$task = new Post();
$task->setAutor($this->getUser()->getUsername());
$task->setIdTematu($temat);
$task->setCzasAdd(new \DateTime("now"));
$form = $this->createFormBuilder($task)->add('Tresc', TextareaType::class)->add('Zapisz', SubmitType::class, array('label' => 'Dodaj'))->getForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->savePost($task);
$this->upgradePost($page);
}
$em = $this->getDoctrine()->getManager();
$query = $em->createQuery("SELECT u FROM AppBundle:Post u WHERE u.idTematu = :id ");
$query->setParameter('id', $temat);
$tematy = $query->getResult();
$size = sizeof($tematy);
return $this->render('Posts/post_page.html.twig', array('form' => $form->createView(), 'size' => $size, 'tematy' => $tematy, "page" => $page));
} else {
$em = $this->getDoctrine()->getManager();
$query = $em->createQuery("SELECT u FROM AppBundle:Post u WHERE u.idTematu = :id ");
$query->setParameter('id', $temat);
$tematy = $query->getResult();
$size = sizeof($tematy);
return $this->render('Posts/post_page.html.twig', array('size' => $size, 'tematy' => $tematy, "page" => $page));
}
}