From db62d3a5d7d97f03ff44ebf130c1371f452767ee Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 17 Jun 2019 19:06:40 +1000 Subject: [PATCH] Remove more uses of CRM_Core_DAO:: that are unncessary --- CRM/Contact/BAO/Relationship.php | 2 +- CRM/Contact/Page/Inline/Website.php | 2 +- CRM/Contribute/BAO/Contribution.php | 2 +- CRM/Contribute/BAO/ContributionSoft.php | 3 ++- CRM/Core/BAO/Website.php | 2 +- CRM/Event/BAO/Participant.php | 2 +- CRM/Event/Form/ParticipantFeeSelection.php | 2 +- CRM/Financial/BAO/FinancialTypeAccount.php | 2 +- CRM/Financial/BAO/Payment.php | 2 +- CRM/Financial/Page/FinancialType.php | 3 ++- CRM/Member/BAO/Membership.php | 2 +- CRM/Utils/Mail/Incoming.php | 4 +--- CRM/Utils/String.php | 2 +- tests/phpunit/api/v3/ContributionTest.php | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 4898e7f204..1f10c64302 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -1751,7 +1751,7 @@ SELECT count(*) AND is_current_member = 1"; $result = CRM_Core_DAO::singleValueQuery($query); if ($result < CRM_Utils_Array::value('max_related', $membershipValues, PHP_INT_MAX)) { - CRM_Member_BAO_Membership::create($membershipValues, CRM_Core_DAO::$_nullArray); + CRM_Member_BAO_Membership::create($membershipValues); } } } diff --git a/CRM/Contact/Page/Inline/Website.php b/CRM/Contact/Page/Inline/Website.php index 929ec1e509..5e9ce5ea2c 100644 --- a/CRM/Contact/Page/Inline/Website.php +++ b/CRM/Contact/Page/Inline/Website.php @@ -48,7 +48,7 @@ class CRM_Contact_Page_Inline_Website extends CRM_Core_Page { $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); $params = ['contact_id' => $contactId]; - $websites = CRM_Core_BAO_Website::getValues($params, CRM_Core_DAO::$_nullArray); + $websites = CRM_Core_BAO_Website::getValues($params); if (!empty($websites)) { foreach ($websites as $key => & $value) { $value['website_type'] = $websiteTypes[$value['website_type_id']]; diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 3352e57c75..fd873f3de6 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -705,7 +705,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { * * @return CRM_Contribute_BAO_Contribution */ - public static function retrieve(&$params, &$defaults, &$ids) { + public static function retrieve(&$params, &$defaults = [], &$ids = []) { $contribution = CRM_Contribute_BAO_Contribution::getValues($params, $defaults, $ids); return $contribution; } diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index 8b7e1ec8c9..1ddfbedc56 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -168,8 +168,9 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio $honorId = CRM_Utils_Array::value(0, $ids); } + $null = []; $honorId = CRM_Contact_BAO_Contact::createProfileContact( - $params['honor'], CRM_Core_DAO::$_nullArray, + $params['honor'], $null, $honorId, NULL, $form->_values['honoree_profile_id'] ); diff --git a/CRM/Core/BAO/Website.php b/CRM/Core/BAO/Website.php index 57bd28beee..f7fba2c6a2 100644 --- a/CRM/Core/BAO/Website.php +++ b/CRM/Core/BAO/Website.php @@ -153,7 +153,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website { * * @return bool */ - public static function &getValues(&$params, &$values) { + public static function &getValues(&$params = [], &$values = []) { $websites = []; $website = new CRM_Core_DAO_Website(); $website->contact_id = $params['contact_id']; diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index db4bf4f7c2..9819a2712f 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -161,7 +161,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { * * @return CRM_Event_BAO_Participant|null the found object or null */ - public static function getValues(&$params, &$values, &$ids) { + public static function getValues(&$params, &$values = [], &$ids = []) { if (empty($params)) { return NULL; } diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index 50511fba17..ee1827f388 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -244,7 +244,7 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { // email sending if (!empty($params['send_receipt'])) { $fetchParticipantVals = ['id' => $this->_participantId]; - CRM_Event_BAO_Participant::getValues($fetchParticipantVals, $participantDetails, CRM_Core_DAO::$_nullArray); + CRM_Event_BAO_Participant::getValues($fetchParticipantVals, $participantDetails); $participantParams = array_merge($params, $participantDetails[$this->_participantId]); $mailSent = $this->emailReceipt($participantParams); } diff --git a/CRM/Financial/BAO/FinancialTypeAccount.php b/CRM/Financial/BAO/FinancialTypeAccount.php index faa84e3f69..be81d888e1 100644 --- a/CRM/Financial/BAO/FinancialTypeAccount.php +++ b/CRM/Financial/BAO/FinancialTypeAccount.php @@ -51,7 +51,7 @@ class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFin * * @return CRM_Contribute_BAO_ContributionType */ - public static function retrieve(&$params, &$defaults, &$allValues = []) { + public static function retrieve(&$params, &$defaults = [], &$allValues = []) { $financialTypeAccount = new CRM_Financial_DAO_EntityFinancialAccount(); $financialTypeAccount->copyValues($params); $financialTypeAccount->find(); diff --git a/CRM/Financial/BAO/Payment.php b/CRM/Financial/BAO/Payment.php index 9a463033b6..c1608c805e 100644 --- a/CRM/Financial/BAO/Payment.php +++ b/CRM/Financial/BAO/Payment.php @@ -492,7 +492,7 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) protected static function getContributionAndParamsInFormatForRecordFinancialTransaction($contributionId) { $getInfoOf['id'] = $contributionId; $defaults = []; - $contributionDAO = CRM_Contribute_BAO_Contribution::retrieve($getInfoOf, $defaults, CRM_Core_DAO::$_nullArray); + $contributionDAO = CRM_Contribute_BAO_Contribution::retrieve($getInfoOf, $defaults); // build params for recording financial trxn entry $params['contribution'] = $contributionDAO; diff --git a/CRM/Financial/Page/FinancialType.php b/CRM/Financial/Page/FinancialType.php index 6bb3b325ff..f0e1f18232 100644 --- a/CRM/Financial/Page/FinancialType.php +++ b/CRM/Financial/Page/FinancialType.php @@ -121,7 +121,8 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic { $params['entity_id'] = $dao->id; $params['entity_table'] = 'civicrm_financial_type'; - CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, CRM_Core_DAO::$_nullArray, $financialAccountIds); + $null = []; + CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, $null, $financialAccountIds); foreach ($financialAccountIds as $key => $values) { if (!empty($financialAccounts[$values['financial_account_id']])) { diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index ed44d86a56..833b049fa2 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -261,7 +261,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { * * @return CRM_Member_BAO_Membership|CRM_Core_Error */ - public static function create(&$params, &$ids, $skipRedirect = FALSE) { + public static function create(&$params, &$ids = [], $skipRedirect = FALSE) { // always calculate status if is_override/skipStatusCal is not true. // giving respect to is_override during import. CRM-4012 diff --git a/CRM/Utils/Mail/Incoming.php b/CRM/Utils/Mail/Incoming.php index 0c5e5300e1..eed6ec8075 100644 --- a/CRM/Utils/Mail/Incoming.php +++ b/CRM/Utils/Mail/Incoming.php @@ -497,9 +497,7 @@ class CRM_Utils_Mail_Incoming { CRM_Utils_String::extractName($name, $params); - return CRM_Contact_BAO_Contact::createProfileContact($params, - CRM_Core_DAO::$_nullArray - ); + return CRM_Contact_BAO_Contact::createProfileContact($params); } } diff --git a/CRM/Utils/String.php b/CRM/Utils/String.php index c740e72a1f..d0f295dd18 100644 --- a/CRM/Utils/String.php +++ b/CRM/Utils/String.php @@ -295,7 +295,7 @@ class CRM_Utils_String { } return $match; } - return CRM_Core_DAO::$_nullArray; + return []; } /** diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 4a32122f71..19ef5bfdf8 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -3764,7 +3764,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'account_relationship' => $relationTypeId, 'financial_account_id' => 7, ); - CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, CRM_Core_DAO::$_nullArray); + CRM_Financial_BAO_FinancialTypeAccount::add($financialParams); $this->assertNotEmpty($optionValue['values'][$optionValue['id']]['value']); return $optionValue['values'][$optionValue['id']]['value']; } -- 2.25.1