| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 9 | public function get(string $id): Cart |
|
| 31 | { |
||
| 32 | 9 | $queryBuilder = $this->entityManger->createQueryBuilder(); |
|
| 33 | $queryBuilder |
||
| 34 | 9 | ->select('cart, items') |
|
| 35 | 9 | ->from(Cart::class, 'cart') |
|
| 36 | 9 | ->leftJoin('cart.items', 'items') |
|
| 37 | 9 | ->where('cart.id = :id') |
|
| 38 | 9 | ->setParameter(':id', $id); |
|
| 39 | |||
| 40 | 9 | $query = $queryBuilder->getQuery(); |
|
| 41 | |||
| 42 | try { |
||
| 43 | 9 | return $query->getSingleResult(); |
|
| 44 | 3 | } catch (NoResultException $e) { |
|
| 45 | 3 | throw new CartNotFoundException(); |
|
| 46 | } |
||
| 55 |