mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Make sure transformer accepts null dates.
This commit is contained in:
parent
fae7dabbc2
commit
587ad1298d
@ -95,6 +95,7 @@ class BillTransformer extends TransformerAbstract
|
|||||||
public function transform(Bill $bill): array
|
public function transform(Bill $bill): array
|
||||||
{
|
{
|
||||||
$paidData = $this->paidData($bill);
|
$paidData = $this->paidData($bill);
|
||||||
|
$payDates = $this->payDates($bill);
|
||||||
$data = [
|
$data = [
|
||||||
'id' => (int)$bill->id,
|
'id' => (int)$bill->id,
|
||||||
'name' => $bill->name,
|
'name' => $bill->name,
|
||||||
@ -107,7 +108,7 @@ class BillTransformer extends TransformerAbstract
|
|||||||
'automatch' => intval($bill->automatch) === 1,
|
'automatch' => intval($bill->automatch) === 1,
|
||||||
'active' => intval($bill->active) === 1,
|
'active' => intval($bill->active) === 1,
|
||||||
'attachments_count' => $bill->attachments()->count(),
|
'attachments_count' => $bill->attachments()->count(),
|
||||||
'pay_dates' => $this->payDates($bill),
|
'pay_dates' => $payDates,
|
||||||
'paid_dates' => $paidData['paid_dates'],
|
'paid_dates' => $paidData['paid_dates'],
|
||||||
'next_expected_match' => $paidData['next_expected_match'],
|
'next_expected_match' => $paidData['next_expected_match'],
|
||||||
'links' => [
|
'links' => [
|
||||||
@ -217,6 +218,9 @@ class BillTransformer extends TransformerAbstract
|
|||||||
*/
|
*/
|
||||||
protected function payDates(Bill $bill): array
|
protected function payDates(Bill $bill): array
|
||||||
{
|
{
|
||||||
|
if (is_null($this->start) || is_null($this->end)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
$set = new Collection;
|
$set = new Collection;
|
||||||
$currentStart = clone $this->start;
|
$currentStart = clone $this->start;
|
||||||
while ($currentStart <= $this->end) {
|
while ($currentStart <= $this->end) {
|
||||||
|
Loading…
Reference in New Issue
Block a user