Example #1
0
    public function checkMultipleApplication(Application $application)
    {
        $team = $application->getTeam()->getId();
        $user = '******' . $application->getUser()->getId();
        $query = $this->em->createQuery('SELECT p
		    FROM AppBundle:Application p
		    WHERE p.team = ' . $team . $user . 'and p.origin=\'team\'');
        $appTeams = $query->getResult();
        $query = $this->em->createQuery('SELECT p
		    FROM AppBundle:Application p
		    WHERE p.team = ' . $team . $user . 'and p.origin=\'player\'');
        $appPlayers = $query->getResult();
        if ($appTeams && $appPlayers) {
            foreach ($appTeams as $appTeam) {
                foreach ($appPlayers as $appPlayer) {
                    if ($appTeam->getTeam() == $appPlayer->getTeam() && $appTeam->getUser() == $appPlayer->getUser()) {
                        $user = $appTeam->getUser();
                        $team = $appTeam->getTeam();
                        $game = $team->getGame();
                        $query = $this->em->createQuery('SELECT p
						    FROM AppBundle:Player p
						    WHERE p.user = '******'and p.game = ' . $game->getId());
                        $players = $query->getResult();
                        $player = $players[0];
                        $player->setTeam($team);
                        $this->em->remove($appTeam);
                        $this->em->remove($appPlayer);
                        $this->em->persist($player);
                        $this->em->flush();
                        return;
                    }
                }
            }
        }
    }
Example #2
0
 /**
  * Shows the given interview.
  *
  * @param Application $application
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function showAction(Application $application)
 {
     $interview = $application->getInterview();
     if (is_null($interview)) {
         return $this->redirectToRoute('admissionadmin_show');
     }
     // Only accessible for admin and above, or team members belonging to the same department as the interview
     if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN') && !$interview->isInterviewer($this->getUser())) {
         throw $this->createAccessDeniedException();
     } elseif ($this->getUser() == $application->getUser()) {
         throw $this->createAccessDeniedException();
     }
     return $this->render('interview/show.html.twig', array('interview' => $interview, 'application' => $application));
 }