You are here

function sObject::sObject in Salesforce Suite 5

Same name and namespace in other branches
  1. 5.2 includes/salesforce.php \sObject::sObject()

File

includes/salesforce.php, line 410

Class

sObject
salesforce sObject.

Code

function sObject($type, $id = null, $values = null, $fieldsToNull = null) {

  // deserialize record from nusoap.php
  if (is_array($type)) {
    $this->values = array();
    foreach ($type as $k => $v) {
      if ($k == 'type') {
        $this->type = $v;
      }
      else {
        if ($k == 'Id') {
          if (is_array($v)) {
            $this->id = $v[0];
          }
          else {
            $this->id = $v;
          }
        }
        else {
          $this->values[$k] = $v;
        }
      }
    }
  }
  else {
    $this->type = $type;
    $this->id = $id;
    $this->values = $values;
    $this->fieldsToNull = $fieldsToNull;
  }
}