本文整理汇总了PHP中Company::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::insert方法的具体用法?PHP Company::insert怎么用?PHP Company::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInsert
public function testInsert()
{
$c = new Company();
$c->name = 'Model Persister Company';
$c->insert();
$this->assertNotNull($c->id);
}
示例2: insert
/**
* @param : array $data
* @return int $id
*/
public static function insert($data)
{
if (!is_array($data) || !count($data)) {
return;
}
$shipFromData = $data['shipFrom'];
$shipToData = $data['shipTo'];
$itemData = $data['item'];
$companyData = $data['company'];
$shipFromId = ShipFrom::insert($shipFromData);
$shipToId = ShipTo::insert($shipToData);
$itemId = Item::insert($itemData);
$companyId = Company::insert($companyData);
$orderData = array('reference_no' => 'SPR-' . rand(), 'created_on' => date('Y-m-d'), 'user_id' => User::getUserId(), 'ship_to' => $shipToId, 'ship_from' => $shipFromId, 'item_id' => $itemId, 'company_id' => $companyId);
$id = DB::table('order')->insertGetId($orderData);
return $id;
}
示例3: Company
<?php
include_once $CFG->dirroot . "/lib/classes/" . "application/Company.Class.php5";
include_once $CFG->dirroot . "/lib/classes/" . "application/SubGroup.Class.php5";
$companyObj = new Company();
$dCreated = date('Y-m-d H:i:s');
$GeneralObj->getRequestVars();
$companyObj->setAllVar();
if ($mode == "Add") {
# echo "<pre>"; print_r($_FILES) ; exit;
$redirect_file = "index.php?file=m-companyadd";
$GeneralObj->checkDuplicate('iCompanyId', 'Company', array('vCompanyCodeId'), $redirect_file, "Organization ID Already Exists ", $iCompanyId);
$GeneralObj->checkDuplicate('iCompanyId', 'Company', array('vCompanyName'), $redirect_file, "Organization Name Already Exists ", $iCompanyId);
$GeneralObj->checkDuplicate('iCompanyId', 'Company', array('vEmail'), $redirect_file, "Email Already Exists ", $iCompanyId);
// $userObj->setdCreated($dCreated);
$iCompanyId = $companyObj->insert();
$group = new SubGroup();
$group->createDefaultGroup($iCompanyId);
$msg = MSG_ADD;
$url = 'index.php?file=Company&AX=Yes&var_msg=' . $msg;
header("Location:" . $url);
exit;
} else {
if ($mode == "Update") {
$update_sql = "UPDATE SubGroup sg SET sg.eStatus = '" . $eStatus . "'\n\t\t\tWHERE sg.iCompanyId IN(" . $iCompanyId . ")";
$obj->sql_query($update_sql);
$redirect_file = "index.php?file=m-companyadd&mode=" . $mode . "&iCompanyId=" . $iCompanyId . "";
$GeneralObj->checkDuplicate('iCompanyId', 'Company', array('vCompanyCodeId'), $redirect_file, "Organization ID Already Exists ", $iCompanyId);
$GeneralObj->checkDuplicate('iCompanyId', 'Company', array('vCompanyName'), $redirect_file, "Organization Name Already Exists ", $iCompanyId);
$GeneralObj->checkDuplicate('iCompanyId', 'Company', array('vEmail'), $redirect_file, "Email Already Exists ", $iCompanyId);
$companyObj->update($iCompanyId);
示例4: catch
Flight::ok($array);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('GET /v1/main/company/@id', function ($id) {
try {
$object = Company::select($id);
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('POST /v1/main/company', function () {
try {
$object = Company::insert();
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('PUT /v1/main/company/@id', function ($id) {
try {
$object = Company::update($id);
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('DELETE /v1/main/company/@id', function ($id) {
try {
示例5: foreach
Company::insert($company);
}
} else {
//分支将会被移出
foreach ($_REQUEST as $key => $value) {
$key = strtolower($key);
$nokeys = array("type", "module", "action");
if (!in_array($key, $nokeys)) {
$company = new Company();
$company->content = empty($value) ? "" : $value;
$company->companyKey = $key;
if ($action == "update" && Company::exist($key)) {
//存在,并且需要更新
Company::update($company);
} else {
Company::insert($company);
}
}
}
}
} else {
if ($action == "del") {
$id = isset($_REQUEST["companyId"]) ? $_REQUEST["companyId"] : 0;
//是否允许重置添
$company = new Company(_NONE);
$company->id = $id;
Company::delete($company);
}
}
} catch (Exception $e) {
$result = $e->getMessage();