-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to fetch SalesInvoiceLines from SalesInvoice where there is a '__deferred' array item? #48
Comments
Thanks! I haven't run into that yet. Are you just retrieving one SalesInvoice? |
Thanks for the quick response :) I've fetched all SalesInvoices from my test account (there are 2), and i'm trying to iterate over them to fetch the details: $item = new SalesInvoice($connection);
$invoices = $item->get();
foreach($invoices as $invoice) {
// echo $invoice->InvoiceNumber
foreach($invoice->SalesInvoiceLines as $l) {
// nope, now what :)
}
} |
Ah-hah! This is a special beast according to the [docs](https://developers.exactonline.com/#API example sales invoice.html%3FTocPath%3DExact%2520Online%2520REST%2520API%7CCode%2520examples%7C_____2).
I'll see what I can whip up while I await your feedback. |
I've since fiddled this. Please advise on what you would do different, i'll wrap it in a PR and add some docblocks while i'm at it 👍
|
Pretty good solution @SchizoDuckie :) Thanks. I think this is great. I was in doubt about getting them automatically, but that would always trigger an extra API call for every SalesInvoice and additionally cause a major time increase. If you can submit this as a PR I'll merge it and add some info to the README. |
Excellent. I will create a pull request somewhere today hopefully 👍 |
Thank you! |
Thanks for the quick merge! 👍 |
…ture/StockPosition * 'master' of github.com:mediact/exact-php-client: (26 commits) add two more fields to Contacts Add ID as a fillable field to WebhookSubscription Add docblock to ID field for Contact Add ID as a fillable field to Contact Fix for picqer#48 Docblocks! re picqer#23 Better composer require command Adds gender and title information Add ReceivableList entity. Adds AccountClassification Add primaryKey variable to Transactions entity Add WebhookSubscription entity use small case null instead of NULL add possibility to fetch more than 60 results. Allows more system filter options Update MailMessageAttachment.php Add MailMessage and MailMessageAttachment entities Corrects original github location Adds explicit Subscriptions support Adds support for jsonSerializable ...
can someone provide an example code for getting the salesinvoiceline->attributes from an invoice? i tryed -> `try {
how ever no succes this returns the same as $invoice->SalesInvoiceLines; |
I'm currently trying to fetch the SalesInvoiceLines for a SalesInvoice, but I'm a bit stuck on the API.
Can you clarify with a code example how I should fetch items that are referred with a __deferred array item?
Thanks for a great library by the way 👍
The text was updated successfully, but these errors were encountered: