本文整理汇总了PHP中CRM_Price_BAO_LineItem::save方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Price_BAO_LineItem::save方法的具体用法?PHP CRM_Price_BAO_LineItem::save怎么用?PHP CRM_Price_BAO_LineItem::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Price_BAO_LineItem
的用法示例。
在下文中一共展示了CRM_Price_BAO_LineItem::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Creates a new entry in the database.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
*
* @return CRM_Price_DAO_LineItem
*/
public static function create(&$params)
{
$id = CRM_Utils_Array::value('id', $params);
if ($id) {
CRM_Utils_Hook::pre('edit', 'LineItem', $id, $params);
$op = CRM_Core_Action::UPDATE;
} else {
CRM_Utils_Hook::pre('create', 'LineItem', $params['entity_id'], $params);
$op = CRM_Core_Action::ADD;
}
// unset entity table and entity id in $params
// we never update the entity table and entity id during update mode
if ($id) {
unset($params['entity_id'], $params['entity_table']);
}
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
if (empty($params['financial_type_id'])) {
throw new Exception('Mandatory key(s) missing from params array: financial_type_id');
}
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types, $op);
if (!in_array($params['financial_type_id'], array_keys($types))) {
throw new Exception('You do not have permission to create this line item');
}
}
$lineItemBAO = new CRM_Price_BAO_LineItem();
$lineItemBAO->copyValues($params);
$return = $lineItemBAO->save();
if ($id) {
CRM_Utils_Hook::post('edit', 'LineItem', $id, $lineItemBAO);
} else {
CRM_Utils_Hook::post('create', 'LineItem', $lineItemBAO->id, $lineItemBAO);
}
return $return;
}
示例2: create
/**
* Creates a new entry in the database.
*
* @param array $params (reference) an assoc array of name/value pairs
*
* @return object CRM_Price_DAO_LineItem object
* @access public
* @static
*/
static function create(&$params)
{
//create mode only as we don't support editing line items
CRM_Utils_Hook::pre('create', 'LineItem', $params['entity_id'], $params);
$lineItemBAO = new CRM_Price_BAO_LineItem();
$lineItemBAO->copyValues($params);
$return = $lineItemBAO->save();
CRM_Utils_Hook::post('create', 'LineItem', $params['entity_id'], $params);
return $return;
}
示例3: create
/**
* Creates a new entry in the database.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
*
* @return CRM_Price_DAO_LineItem
*/
public static function create(&$params)
{
$id = CRM_Utils_Array::value('id', $params);
if ($id) {
CRM_Utils_Hook::pre('edit', 'LineItem', $id, $params);
} else {
CRM_Utils_Hook::pre('create', 'LineItem', $params['entity_id'], $params);
}
// unset entity table and entity id in $params
// we never update the entity table and entity id during update mode
if ($id) {
unset($params['entity_id'], $params['entity_table']);
}
$lineItemBAO = new CRM_Price_BAO_LineItem();
$lineItemBAO->copyValues($params);
$return = $lineItemBAO->save();
if ($id) {
CRM_Utils_Hook::post('edit', 'LineItem', $id, $lineItemBAO);
} else {
CRM_Utils_Hook::post('create', 'LineItem', $lineItemBAO->id, $lineItemBAO);
}
return $return;
}
示例4: create
/**
* Creates a new entry in the database.
*
* @param array $params (reference) an assoc array of name/value pairs
*
* @return object CRM_Price_DAO_LineItem object
* @access public
* @static
*/
static function create(&$params)
{
$lineItemBAO = new CRM_Price_BAO_LineItem();
$lineItemBAO->copyValues($params);
return $lineItemBAO->save();
}