| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | public function __invoke(Player $player, Request $request): mixed |
||
| 27 | { |
||
| 28 | $idGame = $request->query->get('idGame'); |
||
| 29 | |||
| 30 | $qb = $this->em->createQueryBuilder() |
||
| 31 | ->select('s', 'COUNT(pc) as nb') |
||
| 32 | ->from('VideoGamesRecords\CoreBundle\Entity\PlayerChartStatus', 's') |
||
| 33 | ->join('s.playerCharts', 'pc') |
||
| 34 | ->where('pc.player = :player') |
||
| 35 | ->setParameter('player', $player) |
||
| 36 | ->groupBy('s.id'); |
||
| 37 | |||
| 38 | if ($idGame !== null) { |
||
| 39 | $qb->join('pc.chart', 'c') |
||
| 40 | ->join('c.group', 'g') |
||
| 41 | ->join('g.game', 'game') |
||
| 42 | ->andWhere('game.id = :idGame') |
||
| 43 | ->setParameter('idGame', (int)$idGame); |
||
| 44 | } |
||
| 45 | |||
| 46 | return $qb->getQuery()->getResult(); |
||
| 47 | } |
||
| 49 |