| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2.0023 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 1 | public function getByCards(QueryBuilder $cardQb): array |
|
| 17 | { |
||
| 18 | 1 | $cardIds = array_map(fn ($card) => $card->getId(), $cardQb->getQuery()->getResult()); |
|
|
|
|||
| 19 | |||
| 20 | 1 | if (count($cardIds) === 0) { |
|
| 21 | return []; |
||
| 22 | } |
||
| 23 | |||
| 24 | 1 | $qb = $this |
|
| 25 | 1 | ->createQueryBuilder('d') |
|
| 26 | 1 | ->innerJoin(Card::class, 'c') |
|
| 27 | 1 | ->innerJoin('c.domains', 'd2', 'WITH', 'd2.id = d.id') |
|
| 28 | 1 | ->where('c.id in (' . implode(',', $cardIds) . ')') |
|
| 29 | 1 | ->groupBy('d.id') |
|
| 30 | 1 | ->orderBy('COUNT(c.id)', 'DESC'); |
|
| 31 | |||
| 32 | 1 | return $qb->getQuery()->getResult(); |
|
| 33 | } |
||
| 35 |