当前位置: 首页>>代码示例>>PHP>>正文


PHP Purchase::getId方法代码示例

本文整理汇总了PHP中Purchase::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Purchase::getId方法的具体用法?PHP Purchase::getId怎么用?PHP Purchase::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Purchase的用法示例。


在下文中一共展示了Purchase::getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

    public static function create(DB $db, Amount $denom, Purchase $p)
    {
        $prepared = $db->prepare('
			INSERT INTO `bills` (
				`entered_at`,
				`denomination`,
				`purchase_id`
			) VALUES (
				NOW(),
				:denomination,
				:purchase_id
			)
		');
        $result = $prepared->execute(array(':denomination' => $denom->get(), ':purchase_id' => $p->getId()));
        if ($result === false) {
            throw new Exception("Unable to log bill.");
        }
        return self::load($db, $db->lastInsertId());
    }
开发者ID:oktoshi,项目名称:skyhook,代码行数:19,代码来源:Bill.php

示例2: executeGeneratePurchase

 public function executeGeneratePurchase(sfWebRequest $request)
 {
     $invoice = Doctrine_Query::create()->from('Invoice i')->where('i.id = ' . $request->getParameter('id'))->fetchOne();
     //create purchase
     $purchase = new Purchase();
     $purchase->setDate(date("Y-m-d"));
     $purchase->setPono(date('h:i:s a'));
     $purchase->save();
     //create purchase details
     foreach ($invoice->getInvoicedetail() as $invdetail) {
         $purchdetail = new PurchaseDetail();
         $purchdetail->setPurchaseId($purchase->getId());
         $purchdetail->setProductId($invdetail->getProductId());
         $purchdetail->setDescription($invdetail->getProduct()->getName());
         $purchdetail->setQty($invdetail->getQty());
         $purchdetail->setPrice(0);
         $purchdetail->setTotal(0);
         $purchdetail->setUnittotal(0);
         $purchdetail->save();
         $purchdetail->updateStockentry();
     }
     $this->redirect("purchase/view?id=" . $purchase->getId());
 }
开发者ID:jaspertomas,项目名称:tmcprogram_tacloban,代码行数:23,代码来源:actions.class.php

示例3: completeTransaction

 public static function completeTransaction(Config $cfg, DB $db, Purchase $p)
 {
     $w = $cfg->getWalletProvider();
     if ($p->isCompleted()) {
         throw new Exception("completeTransaction() was attempted twice on purchase ticket: " . $p->getId());
     }
     try {
         $db->beginTransaction();
         $tx = $w->sendTransaction($p->getCustomerAddress(), $p->recalculateBitcoinAmount());
         $p->setTXID($tx->getId())->setNTXID(self::normalizeTXID($tx->getId()))->setStatus(self::COMPLETE)->setMessage($tx->getMessage())->setNotice($tx->getNotice());
         self::finalize($db, $p);
         self::save($db, $p);
         $db->commit();
     } catch (Exception $e) {
         $db->rollback();
         $erroredOut = self::load($cfg, $db, $p->getId());
         $erroredOut->setStatus(self::ERROR);
         self::save($db, $erroredOut);
         throw $e;
     }
 }
开发者ID:oktoshi,项目名称:skyhook,代码行数:21,代码来源:Purchase.php


注:本文中的Purchase::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。