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