本文整理汇总了PHP中ConfigManager::exportData方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::exportData方法的具体用法?PHP ConfigManager::exportData怎么用?PHP ConfigManager::exportData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::exportData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportData
/**
* Export a data structure from an entity.
*
* @param array $params
* Parameters (entity_type, uuid).
*
* @return array
*/
function exportData(array $params)
{
$api_params = array('id' => $params['entity_id']);
$uuid_params = $params;
if (!($uuid = civicrm_api3('uuid', 'get', $uuid_params))) {
throw new API_Exception(ts('Unable to obtain UUID for %1', array('1' => print_r($params, 1))), 2900);
}
if (!($api = civicrm_api3($params['entity_type'], 'getsingle', $api_params))) {
throw new API_Exception(ts('Unable to obtain %1 with ID %2', array(1 => $params['entity_type'], 2 => $params['entity_id'])));
}
$uuid = $uuid['values']['uuid'];
// Prepend UUID, remove numeric ID.
$export = array_merge(array('uuid' => $uuid), $api);
unset($export['id']);
// If there are entities this entity depends on, add them to the UUID.
if ($dependencies = ConfigManager::getDependencyTypes($params['entity_type'])) {
foreach ($dependencies as $dep_column) {
// payment_processor will be unaffected by this, which is OK it turns out ... for now.
$dep_type = preg_replace('/_id$/', '', $dep_column);
if (!empty($api[$dep_column])) {
// Explode it then iterate.
if ($entity_ids = explode(\CRM_Core_DAO::VALUE_SEPARATOR, $api[$dep_column])) {
foreach ($entity_ids as $entity_id) {
$dep_params = array('entity_type' => $dep_type, 'entity_id' => $api[$dep_column]);
if ($dep = ConfigManager::exportData($dep_params)) {
$export['configmgr_dependencies'][$dep_type][] = $dep;
}
}
}
}
}
}
return $export;
}