0

I am using the Quickbooks sdk from consolibyte and am trying to extract the email address from the customer query. Here is the code:

$CustomerService = new QuickBooks_IPP_Service_Customer();
$customers = $CustomerService->query($this->Context, $this->realm, "SELECT * FROM Customer ");

When I do a print_r($customers) I can see the email address, but am unable to get because it is protected.

How do i get that data? Thanks

rstewart8
  • 89
  • 1
  • 10

1 Answers1

0

There are getters and setters that exactly match the XML/JSON field/node names.

$email = $Customer->getPrimaryEmailAddr()->getAddress();

Or:

$email = $Customer->getXPath('//Customer/PrimaryEmailAddr/Address');

Similarly, for sets:

$Addr = new QuickBooks_IPP_Object_PrimaryEmailAddr();
$Addr->setAddress('keith@consolibyte.com');
$Customer->setPrimaryEmailAddr($Addr);

You can refer to Intuit's docs for field names.

Keith Palmer Jr.
  • 27,666
  • 16
  • 68
  • 105
  • Thanks for your response. I added your recommendation: $email = $Customer->getPrimaryEmailAddr->getAddress(); and I got this error: Notice: Undefined property: QuickBooks_IPP_Object_Customer::$getPrimaryEmailAddr i – rstewart8 Jun 14 '14 at 13:07