本文整理汇总了PHP中CRM_Price_BAO_LineItem::find方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Price_BAO_LineItem::find方法的具体用法?PHP CRM_Price_BAO_LineItem::find怎么用?PHP CRM_Price_BAO_LineItem::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Price_BAO_LineItem
的用法示例。
在下文中一共展示了CRM_Price_BAO_LineItem::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieve
/**
* Takes a bunch of params that are needed to match certain criteria and
* retrieves the relevant objects. Typically, the valid params are only
* price_field_id. This is the inverse function of create. It also
* stores all of the retrieved values in the default array.
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param array $defaults (reference ) an assoc array to hold the flattened values
*
* @return object CRM_Price_BAO_LineItem object
* @access public
* @static
*/
static function retrieve(&$params, &$defaults)
{
$lineItem = new CRM_Price_BAO_LineItem();
$lineItem->copyValues($params);
if ($lineItem->find(TRUE)) {
CRM_Core_DAO::storeValues($lineItem, $defaults);
return $lineItem;
}
return NULL;
}
示例2: array
function upgrade_3_3_beta3($rev)
{
// get the duplicate Ids of line item entries
$dupeLineItemIds = array();
$fields = array('entity_table', 'entity_id', 'price_field_id', 'price_field_value_id');
$mainLineItem = new CRM_Price_BAO_LineItem();
$mainLineItem->find(TRUE);
while ($mainLineItem->fetch()) {
$dupeLineItem = new CRM_Price_BAO_LineItem();
foreach ($fields as $fld) {
$dupeLineItem->{$fld} = $mainLineItem->{$fld};
}
$dupeLineItem->find(TRUE);
$dupeLineItem->addWhere("id != {$mainLineItem->id}");
while ($dupeLineItem->fetch()) {
$dupeLineItemIds[$dupeLineItem->id] = $dupeLineItem->id;
}
$dupeLineItem->free();
}
$mainLineItem->free();
//clean line item table.
if (!empty($dupeLineItemIds)) {
$sql = 'DELETE FROM civicrm_line_item WHERE id IN ( ' . implode(', ', $dupeLineItemIds) . ' )';
CRM_Core_DAO::executeQuery($sql);
}
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
}