| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | private function getCustomerOrder(): CustomerOrder |
||
| 37 | { |
||
| 38 | $em = $this->doctrine->getEntityManager(); |
||
| 39 | $customer = $this->customerManager->getCurrentUserByApiKey(); |
||
| 40 | /** @var CustomerOrderRepository $repository */ |
||
| 41 | $customerOrderRepository = $em->getRepository('AppBundle:CustomerOrder'); |
||
| 42 | $order = $customerOrderRepository->findLastOpenOrder($customer); |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Creating order if isn't exist |
||
| 46 | */ |
||
| 47 | if (!$order) { |
||
| 48 | $order = new CustomerOrder($customer); |
||
| 49 | $em->persist($order); |
||
| 50 | } |
||
| 51 | |||
| 52 | return $order; |
||
| 53 | } |
||
| 54 | } |
||
| 55 |