arrays - PHP SOAP Salesforce Sub Query -


i using soap query our salesforce database , can query , display results. want use relationship queries (sub queries). can results query, struggling displaythe sub query results in php.

i doing following:

$query = "select account.name, (select contact.name, contact.accountid contacts) account name '%test client%'";     $response = $sforceconnection->query($query);      foreach ($response->records $recordset) {     echo "$recordset->name."<br />";     } 

i can display company name fine, struggling display sub query data contact.name , contact.accountid. not sure of correct syntax display these 2 fields.

when run sql following array repose:

["querylocator"]=> null ["done"]=> bool(true) ["records"]=> array(1) {      [0]=> object(stdclass)#10 (3) {          ["id"]=> null ["contacts"]=> object(stdclass)#11 (4) {              ["done"]=> bool(true) ["querylocator"]=> null ["records"]=> array(1) {                  [0]=> object(stdclass)#12 (3) {                      ["id"]=> null ["accountid"]=> string(18) "0015800000uu25zaer" ["name"]=> string(16) "test users" }                  }               ["size"]=> int(1)          } ["name"]=> string(15) "test client"      }  }  

you should able access contacts in following way:

if (isset($recordset->contacts) && isset($recordset->contacts->records) && !empty($recordset->contacts->records)) {   foreach($recordset->contacts->records $contact) {     echo $contact->name;   } } 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

android - CoordinatorLayout, FAB and container layout conflict -