예제 #1
0
 public function addOrderOfProduct($product, $orderID)
 {
     $productDbs = new ProductDBS();
     $product_doc = $productDbs->where('product', $product);
     if (isset($product_doc->get()[0])) {
         //found product in ProductDBS
         if ($product_doc->push('Order', $orderID)) {
             return true;
         } else {
             return false;
         }
     } else {
         //not found product in ProductDBS
         $product_detail = array('product' => $product, 'Order' => array($orderID));
         if ($productDbs->insert($product_detail)) {
             //if($product_doc->push('Order', array('Order_id'=>$data['Order_id']))){
             return true;
         } else {
             return false;
         }
     }
 }