本文整理汇总了PHP中CRM_Core_DAO::getReferencesToTable方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO::getReferencesToTable方法的具体用法?PHP CRM_Core_DAO::getReferencesToTable怎么用?PHP CRM_Core_DAO::getReferencesToTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO
的用法示例。
在下文中一共展示了CRM_Core_DAO::getReferencesToTable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetReferencesToTable
function testGetReferencesToTable()
{
$refs = CRM_Core_DAO::getReferencesToTable(CRM_Financial_DAO_FinancialType::getTableName());
$refsBySource = array();
foreach ($refs as $refSpec) {
$refsBySource[$refSpec->getReferenceTable()] = $refSpec;
}
$this->assertTrue(array_key_exists('civicrm_entity_financial_account', $refsBySource));
$genericRef = $refsBySource['civicrm_entity_financial_account'];
$this->assertEquals('entity_id', $genericRef->getReferenceKey());
$this->assertEquals('entity_table', $genericRef->getTypeColumn());
$this->assertEquals('id', $genericRef->getTargetKey());
$this->assertEquals(TRUE, $genericRef->isGeneric());
}
示例2: cidRefs
/**
* Get array tables and fields that reference civicrm_contact.id.
*
* This includes core tables, custom group tables, tables added by the merge
* hook and (somewhat randomly) the entity_tag table.
*
* Refer to CRM-17454 for information on the danger of querying the information
* schema to derive this.
*
* @todo create an 'entity hook' to allow entities to be registered to CiviCRM
* including all info that is normally in the DAO.
*/
public static function cidRefs()
{
$cidRefs = array();
$coreReferences = CRM_Core_DAO::getReferencesToTable('civicrm_contact');
foreach ($coreReferences as $coreReference) {
if (!is_a($coreReference, 'CRM_Core_Reference_Dynamic')) {
$cidRefs[$coreReference->getReferenceTable()][] = $coreReference->getReferenceKey();
}
}
self::addCustomTablesExtendingContactsToCidRefs($cidRefs);
// FixME for time being adding below line statically as no Foreign key constraint defined for table 'civicrm_entity_tag'
$cidRefs['civicrm_entity_tag'][] = 'entity_id';
// Allow hook_civicrm_merge() to adjust $cidRefs.
// @todo consider adding a way to register entities and have them
// automatically added to this list.
CRM_Utils_Hook::merge('cidRefs', $cidRefs);
return $cidRefs;
}
示例3: cidRefs
/**
* Get array tables and fields that reference civicrm_contact.id.
*
* This includes core tables, custom group tables, tables added by the merge
* hook and (somewhat randomly) the entity_tag table.
*
* Refer to CRM-17454 for information on the danger of querying the information
* schema to derive this.
*
* This function calls the merge hook but the entityTypes hook is the recommended
* way to add tables to this result.
*/
public static function cidRefs()
{
if (isset(\Civi::$statics[__CLASS__]) && isset(\Civi::$statics[__CLASS__]['contact_references'])) {
return \Civi::$statics[__CLASS__]['contact_references'];
}
$contactReferences = array();
$coreReferences = CRM_Core_DAO::getReferencesToTable('civicrm_contact');
foreach ($coreReferences as $coreReference) {
if (!is_a($coreReference, 'CRM_Core_Reference_Dynamic')) {
$contactReferences[$coreReference->getReferenceTable()][] = $coreReference->getReferenceKey();
}
}
self::addCustomTablesExtendingContactsToCidRefs($contactReferences);
// FixME for time being adding below line statically as no Foreign key constraint defined for table 'civicrm_entity_tag'
$contactReferences['civicrm_entity_tag'][] = 'entity_id';
// Allow hook_civicrm_merge() to adjust $cidRefs.
// Note that if entities are registered using the entityTypes hook there
// is no need to use this hook.
CRM_Utils_Hook::merge('cidRefs', $contactReferences);
\Civi::$statics[__CLASS__]['contact_references'] = $contactReferences;
return \Civi::$statics[__CLASS__]['contact_references'];
}