lundi 8 mai 2017

Undefined property: stdClass::$result - Laravel influencing objects of external 3rd party classes?

Basically I'm re-writing an application that uses the Salesforce PHP toolkit - a set of php libraries that I've included into a specific controller on my new Laravel site so that the new site will talk to the cloud based SalesForce product.

A method you can run to insert data into Saleforce is producing "Undefined property: stdClass::$result" errors. Yet this code and integration of the 3rd party salesforce php files works fine in the original version of our website which isn't written in any kind of framework.

Whilst lots of the website had to be rewritten for Laravel compatibility and object orientedness the few lines that run this 3rd party class' method have not really and I don't see why they shouldn't still work.

The details of what I get are...

ErrorException in SforceBaseClient.php line 499:

Undefined property: stdClass::$result

The trace stack that Laravel provides starts...

  1. in SforceBaseClient.php line 499

  2. at HandleExceptions->handleError(8, 'Undefined property: stdClass::$result', '/app/SforceEnterpriseClient/soapclient/SforceBaseClient.php', 499, array('arg' => object(SoapParam))) in SforceBaseClient.php line 499

  3. at SforceBaseClient->_create(object(SoapParam)) in SforceEnterpriseClient.php line 73

I've checked the code in the SforceBaseClient.php file at line 499 what is interesting is that its quite different how the object is formulated within $arg between the new site that doesn't work and the old working website.

On the new site the $arg object contains many "SoapVar Object"s within it where as it doesn't do this on my working site.

If I print_r() both the objects I get...

Working old website:

SoapParam Object ( [param_name] => sObjects [param_data] => Array ( [0] => SoapVar Object ( [enc_type] => 301 [enc_value] => stdClass Object ( [Name] => Stark Enquiry by Fred Blogs [StageName] => Prospecting [Type] => New Business [CloseDate] => 2017-05-15 [AccountId] => 001j000000xirB7 [Main_Customer_Contact__c] => 003j000001Fc5uE [Number_of_Apartments_Required__c] => 1 [Number_of_Adults__c] => 1 [Number_of_Children__c] => 0 [Guest_Name__c] => Fred Blogs [Guest_Telephone_Number__c] => 2070994515 [Guest_Email__c] => test@test.net [Guest_Flight_Number__c] => [Guest_ETA_at_Apartment__c] => 2017-05-10T12:00:00Z [Location__c] => London, UK [Date_From__c] => 2017-05-10 [Date_To__c] => 2017-05-11 [Apartment_Type__c] => Studio Apartments [Nightly_Budget_from__c] => 0 [Nightly_Budget_to__c] => 0 [Stay_Type__c] => Business ) [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) ) ) 1

New website:

SoapParam Object ( [param_name] => sObjects [param_data] => Array ( [Name] => SoapVar Object ( [enc_type] => 301 [enc_value] => Stark Enquiry by Hannah Bunce [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [StageName] => SoapVar Object ( [enc_type] => 301 [enc_value] => Prospecting [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Type] => SoapVar Object ( [enc_type] => 301 [enc_value] => New Business [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [CloseDate] => SoapVar Object ( [enc_type] => 301 [enc_value] => 2017-05-15 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [AccountId] => SoapVar Object ( [enc_type] => 301 [enc_value] => 001j000000xirB7 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Main_Customer_Contact__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 003j000001Fc5uE [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Number_of_Apartments_Required__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 1 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Number_of_Adults__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 1 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Number_of_Children__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 0 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Guest_Name__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => Fred Blogs [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Guest_Telephone_Number__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 2070994515 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Guest_Email__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => test@test.net [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Guest_Flight_Number__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Guest_ETA_at_Apartment__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 2017-05-08T12:00:00Z [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Location__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => London, UK [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Date_From__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 2017-05-08 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Date_To__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 2017-05-10 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Apartment_Type__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => Studio Apartments [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Nightly_Budget_from__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 500 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Nightly_Budget_to__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => 500 [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) [Stay_Type__c] => SoapVar Object ( [enc_type] => 301 [enc_value] => Business [enc_stype] => Opportunity [enc_ns] => urn:enterprise.soap.sforce.com ) ) ) 1

I'm really not sure what running under Laravel has done to alter this. Can anyone shed any light on this ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire