getProject() === null) { throw new \Exception('Cannot handle invoice items without project'); } if ($invoiceItem->getProject()->getId() === null) { throw new \Exception('Cannot handle un-persisted projects'); } if ($invoiceItem->getUser() === null) { throw new \Exception('Cannot handle invoice items without user'); } if ($invoiceItem->getUser()->getId() === null) { throw new \Exception('Cannot handle un-persisted users'); } return [ $invoiceItem->getProject()->getId(), $invoiceItem->getUser()->getId() ]; } protected function mergeSumInvoiceItem(InvoiceItem $invoiceItem, ExportableItem $entry): void { if ($entry->getProject() === null) { return; } if ($entry->getProject()->getInvoiceText() !== null) { $invoiceItem->setDescription($entry->getProject()->getInvoiceText()); } else { $invoiceItem->setDescription($entry->getProject()->getName()); } } public function getId(): string { return 'project_user'; } }