/** * @Serializer\VirtualProperty() * @Serializer\SerializedName("id_team_b") */ public function getIdTeamB() { return $this->teamB->getId(); }
/** * @Route("/update-squad/{id}", name="squads") */ public function teamAction(Team $team) { $params = array('teamId' => $team->getId(), 'category' => 'summary', 'field' => 'Overall', 'subcategory' => 'all', 'statsAccumulationType' => 0, 'includeZeroValues' => 'true', 'isCurrent' => 'true'); $playerData = $this->get('app.whoscored')->loadStatistics('player-stats', $params); return $this->render('', array()); }
/** * Deletes a Team entity. * */ public function deleteAction(Request $request, Team $team) { $em = $this->getDoctrine()->getManager(); $gameId = $team->getGame()->getId(); $query = $em->createQuery('SELECT u FROM AppBundle:Application u where u.team=' . $team->getId()); $applications = $query->getResult(); foreach ($applications as $application) { $em->remove($application); } $query = $em->createQuery('SELECT u FROM AppBundle:Player u where u.team=' . $team->getId()); $players = $query->getResult(); foreach ($players as $player) { $player->setTeam(null); if ($player->getCapitain()) { $player->setCapitain(null); } $em->persist($player); } $em->remove($team); $em->flush(); return $this->forward('AppBundle:Game:show', array('id' => $gameId)); }
public function getGamesByTeam(Team $team) { return $this->createQueryBuilder('game')->select('game, team1, team2, country1, country2')->Where('game.team1 = :teamId')->orWhere('game.team2 = :teamId')->join('game.team1', 'team1')->join('game.team2', 'team2')->join('team1.country', 'country1')->join('team2.country', 'country2')->setParameter('teamId', $team->getId())->getQuery()->execute(); }