• dwm189
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

 Hi,

 

I'm trying to replicate data from Salesforce to a local MySQL database, I can pull the salesforce objects successfully and they each look like this:

 

[0]=> object(SObject)#11 (3) { ["type"]=> string(7) "Account" ["fields"]=> object(stdClass)#213 (4) { ["IsDeleted"]=> string(5) "false" ["MasterRecordId"]=> string(0) "" ["Name"]=> string(4) "Acme" ["Type"]=> string(8) "Prospect" }

["Id"]=> string(18) "0012000000162QEAAY" }

You can clearly see that there is a 'fields' object inside the sObject.  However, when I create an sObject variable to deal with thisI can no longer access the fields

 

for ($i = 0; $i < $record_count; $i++) //foreach ($records as $r) { $r = new SObject($records[$i]); $pass_this['id'] = $r->Id; foreach ($r->fields as $key => $value) { $pass_this[$key] = addslashes($r->fields->$key); }

 You can see that the fields obecjt is now empty?! It cannot parse the foreach statement and it gives the following error

 

 

object(SObject)#211 (3) { ["type"]=> string(7) "Account" ["fields"]=> NULL ["Id"]=> string(1) "0" } Warning: Invalid argument supplied for foreach()

 I am using version 13 of the php toolkit.  Any idea where I am going wrong?

 

Thanks

 

Pete

 

 

 Hi,

 

I'm trying to replicate data from Salesforce to a local MySQL database, I can pull the salesforce objects successfully and they each look like this:

 

[0]=> object(SObject)#11 (3) { ["type"]=> string(7) "Account" ["fields"]=> object(stdClass)#213 (4) { ["IsDeleted"]=> string(5) "false" ["MasterRecordId"]=> string(0) "" ["Name"]=> string(4) "Acme" ["Type"]=> string(8) "Prospect" }

["Id"]=> string(18) "0012000000162QEAAY" }

You can clearly see that there is a 'fields' object inside the sObject.  However, when I create an sObject variable to deal with thisI can no longer access the fields

 

for ($i = 0; $i < $record_count; $i++) //foreach ($records as $r) { $r = new SObject($records[$i]); $pass_this['id'] = $r->Id; foreach ($r->fields as $key => $value) { $pass_this[$key] = addslashes($r->fields->$key); }

 You can see that the fields obecjt is now empty?! It cannot parse the foreach statement and it gives the following error

 

 

object(SObject)#211 (3) { ["type"]=> string(7) "Account" ["fields"]=> NULL ["Id"]=> string(1) "0" } Warning: Invalid argument supplied for foreach()

 I am using version 13 of the php toolkit.  Any idea where I am going wrong?

 

Thanks

 

Pete