Catch null

This commit is contained in:
James Cole
2025-08-06 20:53:30 +02:00
parent b506281bd6
commit 7f5a1bda8d

View File

@@ -106,8 +106,10 @@ class PiggyBankEnrichment implements EnrichmentInterface
]; ];
} }
$this->amounts[$id][$accountId]['current_amount'] = bcadd($this->amounts[$id][$accountId]['current_amount'], $item->current_amount); $this->amounts[$id][$accountId]['current_amount'] = bcadd($this->amounts[$id][$accountId]['current_amount'], $item->current_amount);
if (null !== $this->amounts[$id][$accountId]['pc_current_amount']) {
$this->amounts[$id][$accountId]['pc_current_amount'] = bcadd($this->amounts[$id][$accountId]['pc_current_amount'], $item->native_current_amount); $this->amounts[$id][$accountId]['pc_current_amount'] = bcadd($this->amounts[$id][$accountId]['pc_current_amount'], $item->native_current_amount);
} }
}
// get account currency preference for ALL. // get account currency preference for ALL.
$set = AccountMeta::whereIn('account_id', array_values($this->accountIds))->where('name', 'currency_id')->get(); $set = AccountMeta::whereIn('account_id', array_values($this->accountIds))->where('name', 'currency_id')->get();
@@ -209,8 +211,7 @@ class PiggyBankEnrichment implements EnrichmentInterface
$notes = Note::query()->whereIn('noteable_id', $this->ids) $notes = Note::query()->whereIn('noteable_id', $this->ids)
->whereNotNull('notes.text') ->whereNotNull('notes.text')
->where('notes.text', '!=', '') ->where('notes.text', '!=', '')
->where('noteable_type', PiggyBank::class)->get(['notes.noteable_id', 'notes.text'])->toArray() ->where('noteable_type', PiggyBank::class)->get(['notes.noteable_id', 'notes.text'])->toArray();
;
foreach ($notes as $note) { foreach ($notes as $note) {
$this->notes[(int)$note['noteable_id']] = (string)$note['text']; $this->notes[(int)$note['noteable_id']] = (string)$note['text'];
} }
@@ -222,8 +223,7 @@ class PiggyBankEnrichment implements EnrichmentInterface
$set = DB::table('object_groupables') $set = DB::table('object_groupables')
->whereIn('object_groupable_id', $this->ids) ->whereIn('object_groupable_id', $this->ids)
->where('object_groupable_type', PiggyBank::class) ->where('object_groupable_type', PiggyBank::class)
->get(['object_groupable_id', 'object_group_id']) ->get(['object_groupable_id', 'object_group_id']);
;
$ids = array_unique($set->pluck('object_group_id')->toArray()); $ids = array_unique($set->pluck('object_group_id')->toArray());
@@ -239,7 +239,9 @@ class PiggyBankEnrichment implements EnrichmentInterface
} }
} }
private function collectCurrentAmounts(): void {} private function collectCurrentAmounts(): void
{
}
/** /**
* Returns the suggested amount the user should save per month, or "". * Returns the suggested amount the user should save per month, or "".