本文整理汇总了PHP中CRM_Core_DAO_AllCoreTables::daoToClass方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_AllCoreTables::daoToClass方法的具体用法?PHP CRM_Core_DAO_AllCoreTables::daoToClass怎么用?PHP CRM_Core_DAO_AllCoreTables::daoToClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_AllCoreTables
的用法示例。
在下文中一共展示了CRM_Core_DAO_AllCoreTables::daoToClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init($fresh = FALSE)
{
static $init = FALSE;
if ($init && !$fresh) {
return;
}
Civi::$statics[__CLASS__] = array();
$file = preg_replace('/\\.php$/', '.data.php', __FILE__);
$entityTypes = (require $file);
CRM_Utils_Hook::entityTypes($entityTypes);
self::$entityTypes = array();
self::$tables = array();
self::$daoToClass = array();
foreach ($entityTypes as $entityType) {
self::registerEntityType($entityType['name'], $entityType['class'], $entityType['table'], isset($entityType['fields_callback']) ? $entityType['fields_callback'] : NULL, isset($entityType['links_callback']) ? $entityType['links_callback'] : NULL);
}
$init = TRUE;
}
示例2: civicrm_api3_generic_getrefcount
/**
* API to determine if a record is in-use.
*
* @param array $apiRequest
* Api request as an array.
*
* @throws API_Exception
* @return array
* API result (int 0 or 1)
*/
function civicrm_api3_generic_getrefcount($apiRequest)
{
$entityToClassMap = CRM_Core_DAO_AllCoreTables::daoToClass();
if (!isset($entityToClassMap[$apiRequest['entity']])) {
throw new API_Exception("The entity '{$apiRequest['entity']}' is unknown or unsupported by 'getrefcount'. Consider implementing this API.", 'getrefcount_unsupported');
}
$daoClass = $entityToClassMap[$apiRequest['entity']];
/* @var $dao CRM_Core_DAO */
$dao = new $daoClass();
$dao->id = $apiRequest['params']['id'];
if ($dao->find(TRUE)) {
return civicrm_api3_create_success($dao->getReferenceCounts());
} else {
return civicrm_api3_create_success(array());
}
}