Quantcast
Viewing all articles
Browse latest Browse all 2504

PHP API: print_r or var_dump of object is empty (7 Comments)

Topic by Eric Den Hollander

I'm using the Connect PHP API and am using this code to get a RightNow Customer object:

$contact = RNCPHP\Contact::fetch(186762);

When I do a print_r or a var_dump of $contact, all the values are empty. 

However, if I echo or assign a variable a parameter of the $contact object and then do an print_r or var_dump, that particular parameter is filled in. Why is this happening?

echo $contact->ID;
$a = $contact->Address->Street;
 
Then I get:
 
RightNow\Connect\v1_2\Contact Object
(
    [ID] => 186762
    [LookupName] => 
    [CreatedTime] => 
    [UpdatedTime] => 
    [Address] => RightNow\Connect\v1_2\Address Object
        (
            [City] => 
            [Country] => 
            [PostalCode] => 
            [StateOrProvince] => 
            [Street] => 15 Main St
 
See how the other parameters such as City or LookupName are empty and how the the ones I specifically echo-ed are now filled in? 

 


Viewing all articles
Browse latest Browse all 2504

Trending Articles