Fix CategoryItemAPI->saveMap to save items with parents.
continuous-integration/drone/push Build is passing Details

main
KKlochko 2 years ago
parent 387858a2de
commit db70255f4f

@ -19,10 +19,10 @@ class CategoryItemAPI extends AbstractItemAPI
} }
public function saveMap($categotiesItems, $company = null) { public function saveMap($categotiesItems, $company = null) {
foreach ($categotiesItems as $category) { foreach ($categotiesItems as $category_json) {
$uuid = $category['id']; $uuid = $category_json['id'];
$name = $category['name']; $name = $category_json['name'];
$url = $category['url']; $url = $category_json['url'];
$category = Category::firstOrCreate([ $category = Category::firstOrCreate([
'uuid' => $uuid, 'uuid' => $uuid,
@ -33,7 +33,7 @@ class CategoryItemAPI extends AbstractItemAPI
$item = new ItemAPI($this->fetcher); $item = new ItemAPI($this->fetcher);
$item->saveMap($category['items']); $item->saveMap($category_json['items'], $category);
} }
} }
} }

Loading…
Cancel
Save