From: eileen Date: Thu, 1 Oct 2020 05:44:49 +0000 (+1300) Subject: [REF] Remove reference to second param returned from CRM_Contact_BAO_Query::apiQuery X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=676a6ff47325458a34221f43b03c126488de3c7a;p=civicrm-core.git [REF] Remove reference to second param returned from CRM_Contact_BAO_Query::apiQuery --- diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 4679168a39..96d94f478d 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -118,7 +118,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { */ public static function getGroupContacts($id) { $params = [['group', 'IN', [1 => $id], 0, 0]]; - list($contacts, $_) = CRM_Contact_BAO_Query::apiQuery($params, ['contact_id']); + [$contacts] = CRM_Contact_BAO_Query::apiQuery($params, ['contact_id']); return $contacts; } diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index 8e44e6aa40..714ccf4ce0 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -555,7 +555,7 @@ SELECT * ['group', 'IN', [$groupID], 0, 0], ['contact_id', '=', $contactID, 0, 0], ]; - list($contacts, $_) = CRM_Contact_BAO_Query::apiQuery($params, ['contact_id']); + [$contacts] = CRM_Contact_BAO_Query::apiQuery($params, ['contact_id']); if (!empty($contacts)) { return TRUE; diff --git a/CRM/Core/BAO/MessageTemplate.php b/CRM/Core/BAO/MessageTemplate.php index bc683a8ec0..e32ab9d4ca 100644 --- a/CRM/Core/BAO/MessageTemplate.php +++ b/CRM/Core/BAO/MessageTemplate.php @@ -238,7 +238,7 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate { } $params = [['contact_id', '=', $contactId, 0, 0]]; - list($contact, $_) = CRM_Contact_BAO_Query::apiQuery($params); + [$contact] = CRM_Contact_BAO_Query::apiQuery($params); //CRM-4524 $contact = reset($contact); @@ -581,7 +581,7 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate { if ($params['toEmail']) { $contactParams = [['email', 'LIKE', $params['toEmail'], 0, 1]]; - list($contact, $_) = CRM_Contact_BAO_Query::apiQuery($contactParams); + [$contact] = CRM_Contact_BAO_Query::apiQuery($contactParams); $prefs = array_pop($contact); diff --git a/Civi/Token/TokenCompatSubscriber.php b/Civi/Token/TokenCompatSubscriber.php index c4a07af559..bdfaa5994e 100644 --- a/Civi/Token/TokenCompatSubscriber.php +++ b/Civi/Token/TokenCompatSubscriber.php @@ -58,7 +58,7 @@ class TokenCompatSubscriber implements EventSubscriberInterface { $params = [ ['contact_id', '=', $contactId, 0, 0], ]; - list($contact, $_) = \CRM_Contact_BAO_Query::apiQuery($params); + [$contact] = \CRM_Contact_BAO_Query::apiQuery($params); //CRM-4524 $contact = reset($contact); if (!$contact || is_a($contact, 'CRM_Core_Error')) { diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTest.php b/tests/phpunit/CRM/Contact/BAO/QueryTest.php index e6ef3bd8b5..e3d02a668d 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTest.php @@ -575,9 +575,9 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { $searchParams = [[$key, '=', strtolower($value), 0, 1]]; } - $result = CRM_Contact_BAO_Query::apiQuery($searchParams); - $this->assertCount(1, $result[0], 'search for ' . $key); - $contact = reset($result[0]); + [$result] = CRM_Contact_BAO_Query::apiQuery($searchParams); + $this->assertCount(1, $result, 'search for ' . $key); + $contact = reset($result); $this->assertEquals('Minnie Mouse', $contact['display_name']); $this->assertEquals('BOb', $contact['current_employer']); }