コード例 #1
0
 public function noticeMicropetitionCreated(Micropetition $micropetition)
 {
     $socialActivity = (new SocialActivity(SocialActivity::TYPE_GROUP_POST_CREATED, $micropetition->getUser(), $micropetition->getGroup()))->setTarget(['id' => $micropetition->getId(), 'title' => $micropetition->getTitle(), 'type' => $micropetition->getType(), 'body' => $micropetition->getPetitionBody()]);
     $this->em->persist($socialActivity);
     $this->em->flush($socialActivity);
     $this->pt->addToQueue('sendSocialActivity', [$socialActivity->getId()]);
     return $socialActivity;
 }
コード例 #2
0
 /**
  * @Route("/{id}/answers/")
  * @Method("GET")
  */
 public function answersListAction(Petition $microPetition)
 {
     if ($microPetition->getGroup() !== $this->getUser()) {
         return $this->createJSONResponse('', 403);
     }
     $answers = $this->getDoctrine()->getRepository(Answer::class)->findByPetition($microPetition);
     return $this->createJSONResponse($this->jmsSerialization($answers, ['api-leader-answers']));
 }
コード例 #3
0
 /**
  * @Route("/details/{id}", requirements={"id"="\d+"}, name="civix_front_petitions_details")
  * @Method({"GET"})
  * @Template("CivixFrontBundle:Group:petitionDetails.html.twig")
  */
 public function petitionDetailsAction(Petition $petition)
 {
     if ($petition->getGroup() !== $this->getUser()) {
         throw new AccessDeniedHttpException();
     }
     $statistics = $this->get('civix_core.poll.micropetition_manager')->getStatisticByPetition($petition, array('#7ac768', '#ba3830'));
     return array('petition' => $petition, 'statistics' => $statistics);
 }
 public function getGroup()
 {
     $this->__load();
     return parent::getGroup();
 }