Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Updates to parse SearchResult...similar to the way QueryResult is parsed #10

Merged
merged 2 commits into from

2 participants

@boonedox

The first commit adds the SforceSearchResult class and updates the search method on SforceBaseClient to use the new class.

The second commit removes the unused properties from the SforceSearchResult class (size,done,and queryLocator are not part of the SearchResult).

@metadaddy-sfdc metadaddy-sfdc merged commit 36625d7 into developerforce:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 29, 2011
  1. add SforceSearchResult class to parse search results...similar to Que…

    Jeremiah Johnson authored
    …ryResult
Commits on Jul 1, 2011
  1. removed unused properties from SforceSearchResult

    Jeremiah Johnson authored
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 1 deletion.
  1. +25 −1 soapclient/SforceBaseClient.php
View
26 soapclient/SforceBaseClient.php
@@ -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);
}
/**
@@ -887,6 +887,30 @@ public function resetPassword($userId) {
}
}
+class SforceSearchResult {
+ public $searchRecords;
+
+ 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;
Something went wrong with that request. Please try again.