Skip to content

Commit

Permalink
Merge pull request #28701 from eileenmcnaughton/get
Browse files Browse the repository at this point in the history
[php8.x] Remove unused undeclared property `_params`, provide __get for transitional support
  • Loading branch information
seamuslee001 authored Dec 18, 2023
2 parents 62f7189 + 7d4bb5e commit 9ec0208
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
3 changes: 1 addition & 2 deletions CRM/Contact/Form/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,14 @@ public function preProcess() {
$paramSubType = implode(',', $contactSubType);
}

$this->_getCachedTree = FALSE;
unset($customGroupCount[0]);
foreach ($customGroupCount as $groupID => $groupCount) {
if ($groupCount > 1) {
$this->set('groupID', $groupID);
//loop the group
for ($i = 1; $i <= $groupCount; $i++) {
CRM_Custom_Form_CustomData::preProcess($this, NULL, $contactSubType,
$i, $this->_contactType, $this->_contactId
$i, $this->_contactType, $this->_contactId, NULL, FALSE
);
CRM_Contact_Form_Edit_CustomData::buildQuickForm($this);
}
Expand Down
18 changes: 18 additions & 0 deletions CRM/Contribute/Form/AbstractEditPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,24 @@ protected function setContributionID(?int $contributionID): void {
*/
protected $invoiceID;

/**
* Provide support for extensions that are used to being able to retrieve _lineItem
*
* Note extension should call getPriceSetID() and getLineItems() directly.
* They are supported for external use per the api annotation.
*
* @param string $name
*
* @noinspection PhpUnhandledExceptionInspection
*/
public function __get($name) {
if ($name === '_params') {
CRM_Core_Error::deprecatedWarning('attempt to access undefined property _params - use externally supported function getSubmittedValues()');
return $this->getSubmittedValues();
}
CRM_Core_Error::deprecatedWarning('attempt to access invalid property :' . $name);
}

/**
* Get the unique invoice ID.
*
Expand Down
8 changes: 4 additions & 4 deletions CRM/Custom/Form/CustomData.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ public static function addToForm(&$form, $entitySubType = NULL, $subName = NULL,
* participant data this could be a value representing role.
* @param null|string $subType
* @param null|int $groupCount
* @param string $type
* @param null $type
* @param null|int $entityID
* @param null $onlySubType
* @param bool $isLoadFromCache
*
* @throws \CRM_Core_Exception
*/
public static function preProcess(
&$form, $extendsEntityColumn = NULL, $subType = NULL,
$groupCount = NULL, $type = NULL, $entityID = NULL, $onlySubType = NULL
$groupCount = NULL, $type = NULL, $entityID = NULL, $onlySubType = NULL, $isLoadFromCache = TRUE
) {
if (!$type) {
CRM_Core_Error::deprecatedWarning('type should be passed in');
Expand Down Expand Up @@ -131,7 +132,6 @@ public static function preProcess(
}

$gid = (isset($form->_groupID)) ? $form->_groupID : NULL;
$getCachedTree = $form->_getCachedTree ?? TRUE;
if (!is_array($subType) && str_contains(($subType ?? ''), CRM_Core_DAO::VALUE_SEPARATOR)) {
CRM_Core_Error::deprecatedWarning('Using a CRM_Core_DAO::VALUE_SEPARATOR separated subType deprecated, use a comma-separated string instead.');
$subType = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($subType, CRM_Core_DAO::VALUE_SEPARATOR));
Expand All @@ -154,7 +154,7 @@ public static function preProcess(
$gid,
$subType,
$extendsEntityColumn,
$getCachedTree,
$isLoadFromCache,
$onlySubType,
FALSE,
CRM_Core_Permission::EDIT,
Expand Down
3 changes: 0 additions & 3 deletions CRM/Event/Form/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,6 @@ public function submit(array $params) {
if ($this->_isPaidEvent) {
[$lineItem, $params] = $this->preparePaidEventProcessing($params);
}
// @todo - params is unused - remove in favour of __get
// but there is another parameter we need to fix first.
$this->_params = $params;
// @todo - stop assigning these - pass financial_trxnId in token context
// and swap template to use tokens.
$this->assign('credit_card_type', $this->getSubmittedValue('credit_card_type'));
Expand Down

0 comments on commit 9ec0208

Please sign in to comment.