You are here

function sObject::serialize in Salesforce Suite 5

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

File

includes/salesforce.php, line 441

Class

sObject
salesforce sObject.

Code

function serialize() {
  $valuesSer['type'] = $this->type;
  if ($this->fieldsToNull != null) {
    $fieldsToNull = array();
    $index = 0;
    foreach ($this->fieldsToNull as $value) {
      $fieldsToNull[$index] = $value;
      $index++;
    }
    $valuesSer['fieldsToNull'] = new RepeatedElementsArray('fieldsToNull', $fieldsToNull);
  }
  $valuesSer['Id'] = $this->id;
  foreach ($this->values as $k => $v) {
    $valuesSer[$k] = $v;
  }
  $sobj = new soapval('sObject', false, $valuesSer);
  return $sobj
    ->serialize();
}