當前位置: 首頁>>代碼示例>>PHP>>正文


PHP order::setId方法代碼示例

本文整理匯總了PHP中order::setId方法的典型用法代碼示例。如果您正苦於以下問題:PHP order::setId方法的具體用法?PHP order::setId怎麽用?PHP order::setId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在order的用法示例。


在下文中一共展示了order::setId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildDomainObject

 protected function buildDomainObject($row)
 {
     $order = new order();
     $order->setId($row['cart_id']);
     $order->setTacosId($row['tacos_id']);
     $order->setTacosName($row['tacos_name']);
     $order->setNumber($row['cart_number']);
     $order->setPrice($row['tacos_price'] * $row['cart_number']);
     return $order;
 }
開發者ID:polytechlyon-isi2,項目名稱:Tacosmopolite,代碼行數:10,代碼來源:OrderDAO.php

示例2: buildorder

 /**
  * Instantiates an order entity and sets its properties using db data.
  *
  * @param array $orderData
  *   The array of db data.
  *
  * @return \MusicBox\Entity\order
  */
 protected function buildorder($orderData)
 {
     $order = new order();
     $order->setId($orderData['order_id']);
     $order->setName($orderData['name']);
     $order->setShortBiography($orderData['short_biography']);
     $order->setBiography($orderData['biography']);
     $order->setSoundCloudUrl($orderData['soundcloud_url']);
     $order->setImage($orderData['image']);
     $order->setLikes($orderData['likes']);
     $createdAt = new \DateTime('@' . $orderData['created_at']);
     $order->setCreatedAt($createdAt);
     return $order;
 }
開發者ID:maxromov,項目名稱:2hd,代碼行數:22,代碼來源:OrderRepository.php

示例3: save

 /**
  * Save given order
  * @param order
  * @param array
  * @return bool
  */
 public function save(order $order, array $products, array $visited)
 {
     // order data
     $data = $order->__toArray();
     $data['at'] = date('Y-m-d H:i:s', time());
     $data['delivery_type_id'] = $data['delivery_type']->getId();
     unset($data['delivery_type']);
     $data['payment_type_id'] = $data['payment_type']->getId();
     unset($data['payment_type']);
     $data['status_id'] = $data['status']->getId();
     unset($data['status']);
     // start transaction
     dibi::begin();
     try {
         $this->insert($data);
         $order_id = dibi::query('SELECT LAST_INSERT_ID()')->fetchSingle();
         $order->setId($order_id);
         $order->dirty(order::UNDIRT);
         foreach (mapper::products()->findByIds(array_keys($products)) as $product) {
             dibi::query('INSERT INTO [:prefix:orders_products]', array('order_id' => $order_id, 'product_id' => $product->getId(), 'price' => $product->getPrice(), 'amount' => $products[$product->getId()]));
         }
         foreach ($visited as $_) {
             $values = array('order_id' => $order_id);
             $values['product_id'] = $_[0]->getId();
             $values['visited_at'] = date('Y-m-d H:i:s', $_[1]);
             dibi::query('INSERT INTO [:prefix:order_visited_products]', $values);
         }
         $mail = new Mail();
         $mail->setFrom(Environment::expand('%shopEmail%'))->addTo(Environment::expand('%shopEmail%'))->setSubject(__('New order'))->setBody(__('Hello, new order arrived'))->send();
         $mail = new Mail();
         $mail->setFrom(Environment::expand('%shopEmail%'))->addTo($data['email'])->setSubject(__('Your order at %s has been accepted', Environment::expand('%shopName%')))->setBody(str_replace('\\n', "\n", __('Hello, your order has been accepted.')))->send();
     } catch (Exception $e) {
         dibi::rollback();
         return FALSE;
     }
     dibi::commit();
     return TRUE;
 }
開發者ID:jakubkulhan,項目名稱:shopaholic,代碼行數:44,代碼來源:orders.php


注:本文中的order::setId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。