public function getInscriptionByPairAction($idPair)
 {
     $this->inscriptionService->setManager($this->getDoctrine()->getManager());
     $inscriptions = $this->inscriptionService->getInscriptionsByPair($idPair);
     $pairService = new PairService();
     $pairService->setManager($this->getDoctrine()->getManager());
     $pair = $pairService->getPair($idPair);
     if (!$pair instanceof Pair) {
         return $this->util->setResponse(400, Literals::PairNotFound);
     } else {
         $dataToSend = json_encode(array('inscription' => $inscriptions));
         return $this->util->setJsonResponse(200, $dataToSend);
     }
 }
Exemple #2
0
 public function modifyUser($user, $params, $controller)
 {
     $user = $this->setUserModify($user, $params);
     $validator = $controller->get('validator');
     $errors = $validator->validate($user);
     if (count($errors) > 0) {
         $errorsString = (string) $errors;
         return array('result' => 'fail', 'message' => $errorsString);
     }
     $this->em->persist($user);
     $this->em->flush();
     $pairService = new PairService();
     $pairService->setManager($this->em);
     $pairService->modifyPairGender($user->getId());
     return array('result' => 'ok', 'message' => $user);
 }
Exemple #3
0
 public function getGamesByUser($idUser)
 {
     $pairService = new PairService();
     $pairService->setManager($this->em);
     $pairs = $pairService->getPairByUser($idUser);
     $games = array();
     foreach ($pairs as $pair) {
         foreach ($this->getGamesByPair($pair->getId()) as $game) {
             $games[] = $game;
         }
     }
     return $games;
 }
 private function getPairFromId($idPair)
 {
     $pairService = new PairService();
     $pairService->setManager($this->em);
     $pair = $pairService->getPair(isset($idPair) ? $idPair : '');
     return $pair;
 }