• MJBusch
  • NEWBIE
  • 25 Points
  • Member since 2010

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

 

When the partner wsdl is used.

During create/update/upsert commands a reference field can in Java be populated by using code like this.

 

-----------

 

SObject referencedobject=new SObject();
MessageElement[] refencedobjectInfo=new MessageElement[1];

refencedobjectInfo[0]=new MessageElement(new QName("ext_id__c"), 12);

referencedobject.setType("Contact");
referencedobject.set_any(refencedobjectInfo)

....

 

carInfo[1]=new MessageElement(new QName("Designer__r"), referencedObject);

 

....

 

-----------

 

This works fine and is well documented in the apex_api. But now im trying to do the same in php,  using the following code:

 

----- 

 

$designer=new stdclass();
$designerInfo=array('ext_id__c'=>'12');

$designer->type="Contact";
$designer->fields=$designerInfo;

$carInfo= array('Name' => 'happyCar', 'Designer__r' => $designer);

$car=new stdClass();
$car->type="Car_Model__c";
$car->fields=$carInfo;

$createResp=$sfCon->create(array($car));
print_r($createResp);

---------------------------

This gives an error:

 

Catchable fatal error: Object of class stdClass could not be converted to string in /data/home/mjb/www/extern/salesforce/soapclient/SforceBaseClient.php on line 392

 

I can't find any documentation on this, so if anyone could give me a hint, on how to make this work in PHP i would be grateful.

Message Edited by MJBusch on 01-04-2010 05:14 AM

So I have two custom objects, class and location with the relation class --> location.

 

When I make my call I use the following:

 

Select c.Location__r.Name, c.Course_Name__c From Class__c c

 

It works fine, but I am noticing that the relationship seems to be returning an array.  I'm not familiar enough with Eclipse to verify this, but since you have to click on the relationship to see the data that was my guess.

 

I have two questions on the process:

(1) Should I tell my PHP script to expect an array?  Or since I know it's going to be one value in all cases, can I just call it a varriable of the correct type?

 

(2) Is there any way to do a more traditional join?

 

Thanks all!

 

When the partner wsdl is used.

During create/update/upsert commands a reference field can in Java be populated by using code like this.

 

-----------

 

SObject referencedobject=new SObject();
MessageElement[] refencedobjectInfo=new MessageElement[1];

refencedobjectInfo[0]=new MessageElement(new QName("ext_id__c"), 12);

referencedobject.setType("Contact");
referencedobject.set_any(refencedobjectInfo)

....

 

carInfo[1]=new MessageElement(new QName("Designer__r"), referencedObject);

 

....

 

-----------

 

This works fine and is well documented in the apex_api. But now im trying to do the same in php,  using the following code:

 

----- 

 

$designer=new stdclass();
$designerInfo=array('ext_id__c'=>'12');

$designer->type="Contact";
$designer->fields=$designerInfo;

$carInfo= array('Name' => 'happyCar', 'Designer__r' => $designer);

$car=new stdClass();
$car->type="Car_Model__c";
$car->fields=$carInfo;

$createResp=$sfCon->create(array($car));
print_r($createResp);

---------------------------

This gives an error:

 

Catchable fatal error: Object of class stdClass could not be converted to string in /data/home/mjb/www/extern/salesforce/soapclient/SforceBaseClient.php on line 392

 

I can't find any documentation on this, so if anyone could give me a hint, on how to make this work in PHP i would be grateful.

Message Edited by MJBusch on 01-04-2010 05:14 AM