function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AlexPHPAlexPHP 

How to properly use the class SObject (in PHP Toolkit v13)

Hey guys

 

I'm a bit confused on how to properly use the class SObject (located in SforcePartnerClient.php) of the PHP Toolkit v13.  I couldn't find a sample code that utilize this, so hoping that one of you can point me in the right direction.

 

class SObject's constructor method signature is as follows:

 

public function __construct($response=NULL) {

So it seems like it should receive a a QueryResult response, but in actuality I think it is suppose to receive a response record (i.e. an SObject record).

 

However, if you look a bit further into the constructor of class SObject, you will see that it sets the Id to be the first element of the response's Id property.

 

if (isset($response->Id)) $this->Id = $response->Id[0];

 This seems to work for the older version of the PHP Toolkit (v11), because that version seems to return stranger response records, where Id would be an array of Ids...

 

[Id] => Array
    (
        [0] => a0F40000003l4ehEAA
        [1] => a0F40000003l4ehEAA
    )

 

 

But in version 13 of the PHP Toolkit, the response records are already SObject objects...

 

[Id] => a0F40000003l4ehEAA

and seems to make the use of class SObject obsolete?

 

 

Am I interpreting this incorrectly???  How do you properly use the SObject class?

 

Your input would be greatly appreciated.