Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.1.0
-
Fix Version/s: 4.7.13
-
Component/s: CiviCRM API
-
Labels:None
-
Documentation Required?:None
-
Funding Source:Core Team Funds
Description
The API getfields returns custom fields as well as entity fields but I noticed that when the entity is a type that doesn't have custom fields associated with it it does an unecessary DB query
I think
_civicrm_api_get_custom_fields($entity, &$params){
Should be able to call
CRM_Core_BAO_CustomGroup::mapTableName($entity)
To determine if an entity has custom fields (rather than coding a list into the API).
But in order to work need to sort out the fact that api deals in both lower case & camel case entity names & also be able to pass a param where the :default on the switch would return false at that point.
Otherwise we could create a new function but that seems like a worse practice