本文整理汇总了PHP中Purchase::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Purchase::create方法的具体用法?PHP Purchase::create怎么用?PHP Purchase::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Purchase
的用法示例。
在下文中一共展示了Purchase::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create()
{
if (isset($_POST['purid']) && !empty($_POST['purdate']) && !empty($_POST['vendid'])) {
$newPurchase = new Purchase();
$newPurchase->pur_id = $_POST['purid'];
$newPurchase->ord_no = $_POST['odrno'];
$newPurchase->vend_id = $_POST['vendid'];
$newPurchase->pur_amount;
$newPurchase->pur_discount;
$newPurchase->pur_total;
$newPurchase->pur_comment;
$newPurchase->pur_datecreated;
if ($newPurchase->create()) {
return 1;
} else {
return 2;
}
}
}
示例2: addOrUpdatePurchases
private function addOrUpdatePurchases($id, $postedData){
try{
try{
$data = \Purchase::find($id);
}catch (\ActiveRecord\RecordNotFound $ex) {
$data = null;
}
$attributes = $this->getAttrForPurchaesFromPost($postedData, $data);
$rolproducts = array();
if(is_null($data)){
$data = \Purchase::create($attributes);
}else{
$data->update_attributes($attributes);
}
$this->addorupdatePurchaseLineItems($data, $postedData, $rolproducts);
if(count($rolproducts)>0 && $this->mail_for_rols){
$this->prepareMailForROLAlert($rolproducts);
}
}
catch (\Slim\Exception $ex) {
$rtnmsg = "Error";
}
catch (\Exception $ex) {
$rtnmsg = "Error";
}
return $rtnmsg;
}