コード例 #1
0
 /**
  * @Route("/publish/{id}", requirements={"id"="\d+"})
  */
 public function publishAction(Post $post)
 {
     $post->setPublishedAt(new \DateTime());
     $post->setIsPublished(true);
     $this->getDoctrine()->getManager()->persist($post);
     $this->getDoctrine()->getManager()->flush($post);
     $this->get('session')->getFlashBag()->add('notice', 'The post has been successfully published');
     return $this->redirect($this->generateUrl("civix_front_{$this->getUser()->getType()}_post_index"));
 }
 public function setPublishedAt($publishedAt)
 {
     $this->__load();
     return parent::setPublishedAt($publishedAt);
 }