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; }
/** * @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')); }
/** * @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); }