コード例 #1
0
 public function getUsers(\Club\ExchangeBundle\Entity\Exchange $exchange)
 {
     $users = array($exchange->getUser()->getId() => $exchange->getUser());
     foreach ($exchange->getExchangeComments() as $comment) {
         $users[$comment->getUser()->getId()] = $comment->getUser();
     }
     return $users;
 }
コード例 #2
0
 /**
  * @Route("/delete/{id}")
  * @Template()
  */
 public function deleteAction(\Club\ExchangeBundle\Entity\Exchange $exchange)
 {
     $em = $this->getDoctrine()->getManager();
     $exchange->setClosed(true);
     $em->persist($exchange);
     $em->flush();
     $this->get('session')->getFlashBag()->add('notice', $this->get('translator')->trans('Your changes are saved.'));
     return $this->redirect($this->generateUrl('club_exchange_exchange_index'));
 }
コード例 #3
0
 /**
  * @Route("/{id}")
  * @Template()
  */
 public function indexAction(\Club\ExchangeBundle\Entity\Exchange $exchange)
 {
     $em = $this->getDoctrine()->getManager();
     $comments = $em->getRepository('ClubExchangeBundle:ExchangeComment')->findBy(array('exchange' => $exchange->getId()), array('id' => 'DESC'));
     return array('exchange' => $exchange, 'comments' => $comments);
 }