*
* @param string $baoName
*
- * @return string|CRM_Core_DAO
+ * @return string
*/
public static function getCanonicalClassName($baoName) {
return str_replace('_BAO_', '_DAO_', $baoName);
// This map only applies to APIv3
$map = [
'acl' => 'Acl',
- 'ACL' => 'Acl',
'im' => 'Im',
- 'IM' => 'Im',
+ 'pcp' => 'Pcp',
];
- if ($legacyV3 && isset($map[$name])) {
- return $map[$name];
+ if ($legacyV3 && isset($map[strtolower($name)])) {
+ return $map[strtolower($name)];
}
$fragments = explode('_', $name);
$fragment = 'UF' . ucfirst(substr($fragment, 2));
}
}
- // Special case: UFGroup, UFJoin, UFMatch, UFField (if passed in underscore-separated)
- if ($fragments[0] === 'Uf') {
- $fragments[0] = 'UF';
+ // Exceptions to CamelCase: UFGroup, UFJoin, UFMatch, UFField, ACL, IM, PCP
+ $exceptions = ['Uf', 'Acl', 'Im', 'Pcp'];
+ if (in_array($fragments[0], $exceptions)) {
+ $fragments[0] = strtoupper($fragments[0]);
}
return implode('', $fragments);
}
*/
public static function getEntityNameForTable(string $tableName) {
self::init();
+ // CRM-19677: on multilingual setup, trim locale from $tableName to fetch class name
+ if (CRM_Core_I18n::isMultilingual()) {
+ global $dbLocale;
+ $tableName = str_replace($dbLocale, '', $tableName);
+ }
$matches = CRM_Utils_Array::findAll(self::$entityTypes, ['table' => $tableName]);
return $matches ? $matches[0]['name'] : NULL;
}