mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Added a validation to Transformers/LocationsTransformer.php:transformLocations() in case location doesn't have children location (#7640)
This commit is contained in:
parent
2a6a381bc7
commit
9291e3ada3
|
@ -24,11 +24,13 @@ class LocationsTransformer
|
|||
if ($location) {
|
||||
|
||||
$children_arr = [];
|
||||
foreach($location->children as $child) {
|
||||
$children_arr[] = [
|
||||
'id' => (int) $child->id,
|
||||
'name' => $child->name
|
||||
];
|
||||
if(!is_null($location->children)){
|
||||
foreach($location->children as $child) {
|
||||
$children_arr[] = [
|
||||
'id' => (int) $child->id,
|
||||
'name' => $child->name
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$array = [
|
||||
|
|
Loading…
Reference in a new issue