Skip to content

Commit 812f76a

Browse files
committed
applied set_type to map method
1 parent ab0c20a commit 812f76a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Model.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ public static function map($field = 'id', $filters = []) {
165165
if (!$data) return [];
166166

167167
return array_map(function($row) use ($field) {
168-
return is_array($row) ? $row[$field] : $row->{$field};
168+
$value = is_array($row) ? $row[$field] : $row->{$field};
169+
self::_set_type($field, $value);
170+
171+
return $value;
169172
}, $data);
170173
}
171174

@@ -421,7 +424,7 @@ public function to_array($get_fields = null) {
421424

422425
foreach ($properties as $field => $value) {
423426
if (!$get_fields || ($get_fields && in_array($field, $get_fields))) {
424-
$this->_set_type($field, $value);
427+
self::_set_type($field, $value);
425428
$result[$field] = $value;
426429
}
427430
}

0 commit comments

Comments
 (0)