Creation of dynamic property $key

Created on 3 November 2023, about 1 year ago
Updated 31 January 2024, 10 months ago

Problem/Motivation

Creation of dynamic property Drupal\salesforce_mapping\SalesforceMappableEntityTypes::${key} is deprecated

Steps to reproduce

My sites upgraded to Drupal 10.1.5, php 8.2.5.
I access Sobject's mapping field setting form, the url is /admin/structure/salesforce/mappings/manage/{sboject}/fields, and got this deprecated function error. Error detected in line 53 of salesforce/src/Rest/RestResponseDescribe.php. The __construct function is trying to assign values to multiple properties that have not been declared.

public function __construct(RestResponse $response) {
    parent::__construct($response->response);

    $this->name = $response->data['name'];
    $this->fields = [];
    // Index fields by machine name, so we don't have to search every time.
    foreach ($response->data['fields'] as $field) {
      $this->fields[$field['name']] = $field;
    }

    foreach ($response->data as $key => $value) {
      if ($key == 'fields') {
        continue;
      }
      $this->$key = $value; <- This line is problem.
    }
    $this->data = $response->data;
  }

If there is only 1 property, I can fix it according to the patch from related issue https://www.drupal.org/project/salesforce/issues/3397134 ๐Ÿ› Creation of dynamic property time Fixed , but for this case I couldn't find any solution.
If anyone has a solution or patch to fix it please let me know, I'd be very grateful for it !

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Fixed

Version

5.0

Component

salesforce.module

Created by

๐Ÿ‡ป๐Ÿ‡ณVietnam ducviethaboo Ha Noi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024