本文整理汇总了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;
}
示例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;
}
示例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;
}