Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix customGroup getTableNameByEntityName to recognize all entities #18546

Merged
merged 1 commit into from
Sep 21, 2020

Conversation

colemanw
Copy link
Member

Overview

This fixes a bug reported in https://www.drupal.org/project/webform_civicrm/issues/3172201

Before

Not possible via APIv3 to retrieve file attachments from Cases or other entities not in the hardcoded list.

After

Hardcoded list removed; all entities supported.

Technical Details

Code comment suggests that the hardcoded list was part of some early prototyping for the Attachment api. It has since been superseded by a function in CRM_Core_DAO_AllCoreTables which does in a more complete way what it was trying to do.

@civibot
Copy link

civibot bot commented Sep 21, 2020

(Standard links)

@civibot civibot bot added the master label Sep 21, 2020
@demeritcowboy
Copy link
Contributor

Thanks this should also fix https://lab.civicrm.org/dev/core/-/issues/1988

@eileenmcnaughton
Copy link
Contributor

Only called from one place that should have solid test cover

Screen Shot 2020-09-22 at 8 56 35 AM

I was initially worried that there is a separate function which specifies which BAO support custom fields, and that the apiv3 relies on this being hard-coded but I find it is separate -


    // If we have custom fields the BAO may have taken care of it or we may have to.
    // $extendsMap provides a pretty good hard-coded list of BAOs that take care of the custom data.
    if (isset($params['custom']) && empty(CRM_Core_BAO_CustomQuery::$extendsMap[$entity])) {
      CRM_Core_BAO_CustomValueTable::store($params['custom'], CRM_Core_DAO_AllCoreTables::getTableForClass(CRM_Core_DAO_AllCoreTables::getFullName($entity)), $bao->id);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants