Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 public function editOrder(Order $order)
 {
     return $this->db->update('orders', $order->toArray(), 'partnerId = :partnerId AND orderId = :orderId', ['partnerId ' => $order->getPartnerId(), 'orderId' => $order->getOrderId()]);
 }