Skip to content

Commit 71697e5

Browse files
committed
Fixes an issue in subscription endpoints
1 parent 8840c56 commit 71697e5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Models/AModel.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,13 @@ public function __toArray($convert_dates = true): array
133133
$value = $this->{'get' . ucfirst($var)}();
134134

135135
if (is_array($value)) {
136-
$result[$var] = array_map(fn(AModel $model) => $model->__toArray($convert_dates), $value);
136+
$result[$var] = array_map(function($model) use ($convert_dates) {
137+
if ($model instanceof AModel) {
138+
return $model->__toArray($convert_dates);
139+
} else {
140+
return $model;
141+
}
142+
}, $value);
137143
} elseif ($value instanceof AModel) {
138144
$result[$var] = $value->__toArray($convert_dates);
139145
} elseif ($value instanceof DateTime && $convert_dates) {

0 commit comments

Comments
 (0)