mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Handle null invoice object in task (#1153)
This commit is contained in:
parent
fa39434ac9
commit
b7a5ae6059
@ -38,13 +38,18 @@ class TaskTransformer extends EntityTransformer
|
||||
|
||||
public function transform(Task $task)
|
||||
{
|
||||
if($task->invoice)
|
||||
$invoiceId = $task->invoice->public_id;
|
||||
else
|
||||
$invoiceId = null;
|
||||
|
||||
return array_merge($this->getDefaults($task), [
|
||||
'id' => (int) $task->public_id,
|
||||
'description' => $task->description,
|
||||
'duration' => $task->getDuration(),
|
||||
'updated_at' => (int) $this->getTimestamp($task->updated_at),
|
||||
'archived_at' => (int) $this->getTimestamp($task->deleted_at),
|
||||
'invoice_id' => (int) $task->invoice->public_id,
|
||||
'invoice_id' => $invoiceId,
|
||||
'client_id' => (int) $task->client->public_id,
|
||||
'is_deleted' => (bool) $task->is_deleted,
|
||||
'time_log' => $task->time_log,
|
||||
|
Loading…
x
Reference in New Issue
Block a user