| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 1 |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 10 | 1 | public function getPostWithComments($postId) |
|
| 11 | { |
||
| 12 | /** @var QueryBuilder $qb */ |
||
| 13 | 1 | $qb = $this->createQueryBuilder('p'); |
|
| 14 | return $qb |
||
| 15 | 1 | ->select(['p', 'c', 'a']) |
|
| 16 | 1 | ->leftJoin('p.comments', 'c') |
|
| 17 | 1 | ->leftJoin('c.author', 'a') |
|
| 18 | 1 | ->where($qb->expr()->eq('p.id', ':post_id')) |
|
| 19 | 1 | ->orderBy('c.number', 'asc') |
|
| 20 | 1 | ->setParameter('post_id', $postId) |
|
| 21 | 1 | ->getQuery()->getOneOrNullResult() |
|
| 22 | ; |
||
| 23 | } |
||
| 24 | } |