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

(NFC) Fix Warnings When Updating Custom Entities #12033

Merged

Conversation

mickadoo
Copy link
Contributor

@mickadoo mickadoo commented Apr 26, 2018

Overview

Trying to update a custom group or field worked, but it produced warnings about missing indices. This PR fixes those warnings.

Before

Updating an existing CustomGroup or CustomField would work, but produce warnings. This caused some PHPUnit tests to fail if they were updating a CustomGroup or CustomField.

For example:

$params = ['id' => 1, 'is_active' => 0];
civicrm_api3('CustomField', 'create', $params);

Will produce a warning (from a test I wrote for this):

Failure in api call for CustomGroup create:  Undefined index: extends
#0 /repos/civicrm-core/CRM/Core/BAO/CustomGroup.php(64): PHPUnit_Util_ErrorHandler::handleError(8, 'Undefined index...', '/repos/civicrm-...', 64, Array)

After

No warnings are produced.

After

I did some minor cleanup, replacing some arrays with variables and trying to shorten lines. I also deleted one unused variable, $tableName

@colemanw
Copy link
Member

Yay, tests!

@seamuslee001
Copy link
Contributor

Merging as per the label

@seamuslee001 seamuslee001 merged commit b27513d into civicrm:master Apr 26, 2018
mickadoo added a commit to compucorp/civicrm-core that referenced this pull request Apr 30, 2018
mickadoo added a commit to compucorp/civicrm-core that referenced this pull request Apr 30, 2018
@mickadoo mickadoo deleted the 81-fix-warnings-in-custom-entities branch April 30, 2018 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants