description = $journal->description; $entry->date = $journal->date->format('Y-m-d'); $entry->amount = TransactionJournal::amount($journal); $entry->budget = new EntryBudget($journal->budgets->first()); $entry->category = new EntryCategory($journal->categories->first()); $entry->bill = new EntryBill($journal->bill); /** @var Account $sourceAccount */ $sourceAccount = TransactionJournal::sourceAccount($journal); $entry->sourceAccount = new EntryAccount($sourceAccount); /** @var Account $destination */ $destination = TransactionJournal::destinationAccount($journal); $entry->destinationAccount = new EntryAccount($destination); return $entry; } /** * @return array */ public static function getFieldsAndTypes(): array { // key = field name (see top of class) // value = field type (see csv.php under 'roles') return [ 'description' => 'description', 'amount' => 'amount', 'date' => 'date-transaction', 'source_account_id' => 'account-id', 'source_account_name' => 'account-name', 'source_account_iban' => 'account-iban', 'source_account_type' => '_ignore', 'source_account_number' => 'account-number', 'destination_account_id' => 'opposing-id', 'destination_account_name' => 'opposing-name', 'destination_account_iban' => 'opposing-iban', 'destination_account_type' => '_ignore', 'destination_account_number' => 'account-number', 'budget_id' => 'budget-id', 'budget_name' => 'budget-name', 'category_id' => 'category-id', 'category_name' => 'category-name', 'bill_id' => 'bill-id', 'bill_name' => 'bill-name', ]; } }