The PHP methods exactly mirror the XML node names displayed in the Intuit documentation.
For example, Intuit's documentation shows an object like this:
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-04-22T08:58:03.798-07:00">
<Purchase domain="QBO" sparse="false">
<Id>603</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreateTime>2018-07-18T00:00:00-07:00</CreateTime>
<LastUpdatedTime>2014-04-22T08:57:37-07:00</LastUpdatedTime>
</MetaData>
<TxnDate>2018-07-18</TxnDate>
<CurrencyRef name="United States Dollar">USD</CurrencyRef>
<PrivateNote>Taxable expense.</PrivateNote>
<Line>
<Id>1</Id>
<Amount>26.00</Amount>
So, your Purchase object is going to have methods that mirror this XML structure. For example:
$Id = $PurchaseOrder->getId();
$SyncToken = $PurchaseOrder->getSyncToken();
$MetaDataObject = $PurchaseOrder->getMetaData();
$CreateTime = $PurchaseOrder->getMetaData()->getCreateTime();
$TxnDate = $PurchaseOrder->getTxnDate();
Unsurprisingly, there are also ->set*(...)
methods too.
$PurchaseOrder->setTxnDate('2014-04-24');
In the case of line items (which there can be more than one of), you can count the number of Line
nodes like this:
$number_of_lines = $PurchaseOrder->countLine();
And then loop through them:
for ($i = 0; $i < $number_of_lines; $i++)
{
$Line = $PurchaseOrder->getLine($i);
print_r($Line);
}
Unsurprisingly, the Line object will have a method for each node it contains too:
$line_Id = $Line->getId();
$line_Amount = $Line->getAmount();
As a shortcut, you can also use XPath statements to get at this data:
$CreateTime = $Purchase->getXPath('//Purchase/MetaData/CreateTime');