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