Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
add SforceSearchResult class to parse search results...similar to Que…
Browse files Browse the repository at this point in the history
…ryResult
  • Loading branch information
Jeremiah Johnson committed Jun 29, 2011
1 parent 0b1f2d7 commit 5a9d57f
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion soapclient/SforceBaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ public function search($searchString) {
$this->setHeaders("search");
$arg = new stdClass;
$arg->searchString = new SoapVar($searchString, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
return $this->sforce->search($arg)->result;
return new SforceSearchResult($this->sforce->search($arg)->result);
}

/**
Expand Down Expand Up @@ -887,6 +887,33 @@ public function resetPassword($userId) {
}
}

class SforceSearchResult {
public $queryLocator;
public $done;
public $searchRecords;
public $size;

public function __construct($response) {

if($response instanceof SforceSearchResult) {
$this->searchRecords = $response->searchRecords;
} else {
$this->searchRecords = array();
if (isset($response->searchRecords)) {
if (is_array($response->searchRecords)) {
foreach ($response->searchRecords as $record) {
$sobject = new SObject($record->record);
array_push($this->searchRecords, $sobject);
};
} else {
$sobject = new SObject($response->searchRecords->record);
array_push($this->records, $sobject);
}
}
}
}
}

class QueryResult {
public $queryLocator;
public $done;
Expand Down

0 comments on commit 5a9d57f

Please sign in to comment.