本文整理汇总了PHP中CRM_Core_DAO_AllCoreTables::getFullName方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_AllCoreTables::getFullName方法的具体用法?PHP CRM_Core_DAO_AllCoreTables::getFullName怎么用?PHP CRM_Core_DAO_AllCoreTables::getFullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_AllCoreTables
的用法示例。
在下文中一共展示了CRM_Core_DAO_AllCoreTables::getFullName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntityName
/**
* Attempts to retrieve the API entity name from any calling class.
* FIXME: This is a bit hackish but the naming convention for forms is not very strict
*
* @param string|object $classNameOrObject
*
* @return string
* @throws CRM_Core_Exception
*/
public static function getEntityName($classNameOrObject)
{
require_once 'api/api.php';
$className = is_string($classNameOrObject) ? $classNameOrObject : get_class($classNameOrObject);
// First try the obvious replacements
$daoName = str_replace(array('_BAO_', '_Form_', '_Page_'), '_DAO_', $className);
$entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
// If that didn't work, try a different pattern
if (!$entityName) {
list(, $parent, , $child) = explode('_', $className);
$daoName = "CRM_{$parent}_DAO_{$child}";
$entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
}
// If that didn't work, try a different pattern
if (!$entityName) {
$daoName = "CRM_{$parent}_DAO_{$parent}";
$entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
}
// If that didn't work, try a different pattern
if (!$entityName) {
$daoName = "CRM_Core_DAO_{$child}";
$entityName = CRM_Core_DAO_AllCoreTables::getBriefName($daoName);
}
// If that didn't work, try using just the trailing name
if (!$entityName) {
$entityName = CRM_Core_DAO_AllCoreTables::getFullName($child) ? $child : NULL;
}
// If that didn't work, try using just the leading name
if (!$entityName) {
$entityName = CRM_Core_DAO_AllCoreTables::getFullName($parent) ? $parent : NULL;
}
if (!$entityName) {
throw new CRM_Core_Exception('Could not find api name for supplied class');
}
return $entityName;
}
示例2: _civicrm_api3_get_DAO
/**
* Return the DAO of the function or Entity.
*
* @param string $name
* Either a function of the api (civicrm_{entity}_create or the entity name.
* return the DAO name to manipulate this function
* eg. "civicrm_api3_contact_create" or "Contact" will return "CRM_Contact_BAO_Contact"
*
* @return mixed|string
*/
function _civicrm_api3_get_DAO($name)
{
if (strpos($name, 'civicrm_api3') !== FALSE) {
$last = strrpos($name, '_');
// len ('civicrm_api3_') == 13
$name = substr($name, 13, $last - 13);
}
$name = _civicrm_api_get_camel_name($name);
if ($name == 'Individual' || $name == 'Household' || $name == 'Organization') {
$name = 'Contact';
}
// hack to deal with incorrectly named BAO/DAO - see CRM-10859
// FIXME: DAO should be renamed CRM_Mailing_DAO_MailingEventQueue
if ($name == 'MailingEventQueue') {
return 'CRM_Mailing_Event_DAO_Queue';
}
// FIXME: DAO should be renamed CRM_Mailing_DAO_MailingRecipients
// but am not confident mailing_recipients is tested so have not tackled.
if ($name == 'MailingRecipients') {
return 'CRM_Mailing_DAO_Recipients';
}
// FIXME: DAO should be renamed CRM_Mailing_DAO_MailingComponent
if ($name == 'MailingComponent') {
return 'CRM_Mailing_DAO_Component';
}
// FIXME: DAO should be renamed CRM_ACL_DAO_AclRole
if ($name == 'AclRole') {
return 'CRM_ACL_DAO_EntityRole';
}
// FIXME: DAO should be renamed CRM_SMS_DAO_SmsProvider
// But this would impact SMS extensions so need to coordinate
// Probably best approach is to migrate them to use the api and decouple them from core BAOs
if ($name == 'SmsProvider') {
return 'CRM_SMS_DAO_Provider';
}
// FIXME: DAO names should follow CamelCase convention
if ($name == 'Im' || $name == 'Acl') {
$name = strtoupper($name);
}
$dao = CRM_Core_DAO_AllCoreTables::getFullName($name);
if ($dao || !$name) {
return $dao;
}
// Really weird apis can declare their own DAO name. Not sure if this is a good idea...
if (file_exists("api/v3/{$name}.php")) {
include_once "api/v3/{$name}.php";
}
$daoFn = "_civicrm_api3_" . _civicrm_api_get_entity_name_from_camel($name) . "_DAO";
if (function_exists($daoFn)) {
return $daoFn();
}
return NULL;
}
示例3: getDaoClassName
/**
* Return the name of the DAO Class. If a dao class does not exist return an empty value
*
* @return string
*/
protected function getDaoClassName()
{
$daoClassName = CRM_Core_DAO_AllCoreTables::getFullName($this->objectName);
return $daoClassName;
}
示例4: _civicrm_api3_get_DAO
/**
* Function to return the DAO of the function or Entity
* @param String $name either a function of the api (civicrm_{entity}_create or the entity name
* return the DAO name to manipulate this function
* eg. "civicrm_api3_contact_create" or "Contact" will return "CRM_Contact_BAO_Contact"
* @return mixed|string
*/
function _civicrm_api3_get_DAO($name)
{
if (strpos($name, 'civicrm_api3') !== FALSE) {
$last = strrpos($name, '_');
// len ('civicrm_api3_') == 13
$name = substr($name, 13, $last - 13);
}
$name = _civicrm_api_get_camel_name($name, 3);
if ($name == 'Individual' || $name == 'Household' || $name == 'Organization') {
$name = 'Contact';
}
// hack to deal with incorrectly named BAO/DAO - see CRM-10859
// FIXME: DAO should be renamed CRM_Mailing_DAO_MailingRecipients
// but am not confident mailing_recipients is tested so have not tackled.
if ($name == 'MailingRecipients') {
return 'CRM_Mailing_DAO_Recipients';
}
// FIXME: DAO should be renamed CRM_Mailing_DAO_MailingComponent
if ($name == 'MailingComponent') {
return 'CRM_Mailing_DAO_Component';
}
// FIXME: DAO should be renamed CRM_ACL_DAO_AclRole
if ($name == 'AclRole') {
return 'CRM_ACL_DAO_EntityRole';
}
// FIXME: DAO should be renamed CRM_SMS_DAO_SmsProvider
// But this would impact SMS extensions so need to coordinate
// Probably best approach is to migrate them to use the api and decouple them from core BAOs
if ($name == 'SmsProvider') {
return 'CRM_SMS_DAO_Provider';
}
// FIXME: DAO names should follow CamelCase convention
if ($name == 'Im' || $name == 'Acl') {
$name = strtoupper($name);
}
return CRM_Core_DAO_AllCoreTables::getFullName($name);
}
示例5: _civicrm_api3_get_DAO
/**
* Function to return the DAO of the function or Entity
* @param String $name either a function of the api (civicrm_{entity}_create or the entity name
* return the DAO name to manipulate this function
* eg. "civicrm_api3_contact_create" or "Contact" will return "CRM_Contact_BAO_Contact"
* @return mixed|string
*/
function _civicrm_api3_get_DAO($name)
{
if (strpos($name, 'civicrm_api3') !== FALSE) {
$last = strrpos($name, '_');
// len ('civicrm_api3_') == 13
$name = substr($name, 13, $last - 13);
}
$name = _civicrm_api_get_camel_name($name, 3);
if ($name == 'Individual' || $name == 'Household' || $name == 'Organization') {
$name = 'Contact';
}
//hack to deal with incorrectly named BAO/DAO - see CRM-10859 -
// several of these have been removed but am not confident mailing_recipients is
// tests so have not tackled.
// correct approach for im is unclear
if ($name == 'mailing_recipients' || $name == 'MailingRecipients') {
return 'CRM_Mailing_BAO_Recipients';
}
if (strtolower($name) == 'im') {
return 'CRM_Core_BAO_IM';
}
$dao = CRM_Core_DAO_AllCoreTables::getFullName($name);
if ($dao || !$name) {
return $dao;
}
// Really weird apis can declare their own DAO name. Not sure if this is a good idea...
if (file_exists("api/v3/{$name}.php")) {
include_once "api/v3/{$name}.php";
}
$daoFn = "_civicrm_api3_" . _civicrm_api_get_entity_name_from_camel($name) . "_DAO";
if (function_exists($daoFn)) {
return $daoFn();
}
return NULL;
}