public function saveOrder(Order $order) { /** @var Client $client */ $client = $order->getClient(); if (empty($client->getClientId())) { $clientData = $client->toArray(); $clientData['role'] = Defines::ROLE_CLIENT; $clientId = $this->userDao->createUser($clientData); $order->setClientId($clientId); } if (empty($order->getOrderId())) { $orderId = $this->orderDao->crateOrder($order); $order->setOrderId($orderId); } else { $this->orderDao->editOrder($order); } return $order->toArray(); }
public function editOrder(Order $order) { return $this->db->update('orders', $order->toArray(), 'partnerId = :partnerId AND orderId = :orderId', ['partnerId ' => $order->getPartnerId(), 'orderId' => $order->getOrderId()]); }