From 2034c11795282de1e7191a44fb07dbc0bbe40028 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 19 May 2016 09:43:03 +1000 Subject: [PATCH] Include Documents in Invoice transformer --- app/Ninja/Transformers/InvoiceTransformer.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Ninja/Transformers/InvoiceTransformer.php b/app/Ninja/Transformers/InvoiceTransformer.php index c866f1213540..fc17127719a2 100644 --- a/app/Ninja/Transformers/InvoiceTransformer.php +++ b/app/Ninja/Transformers/InvoiceTransformer.php @@ -28,7 +28,7 @@ class InvoiceTransformer extends EntityTransformer 'invitations', 'payments', 'client', - //'expenses', + 'documents', ]; public function __construct($account = null, $serializer = null, $client = null) @@ -68,6 +68,12 @@ class InvoiceTransformer extends EntityTransformer return $this->includeCollection($invoice->expenses, $transformer, ENTITY_EXPENSE); } + public function includeDocuments(Invoice $invoice) + { + $transformer = new DocumentTransformer($this->account, $this->serializer); + return $this->includeCollection($invoice->documents, $transformer, ENTITY_DOCUMENT); + } + public function transform(Invoice $invoice) {