You are here

public function RestResponseDescribe::__construct in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 src/Rest/RestResponseDescribe.php \Drupal\salesforce\Rest\RestResponseDescribe::__construct()
  2. 5.0.x src/Rest/RestResponseDescribe.php \Drupal\salesforce\Rest\RestResponseDescribe::__construct()

See https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest....

Parameters

\Drupal\salesforce\Rest\RestResponse $response: The Response.

Overrides RestResponse::__construct

File

src/Rest/RestResponseDescribe.php, line 39

Class

RestResponseDescribe
Class RestResponseDescribe.

Namespace

Drupal\salesforce\Rest

Code

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->data = $response->data;
}