Skip to content

Commit

Permalink
fix if no subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioMendolia committed Oct 13, 2023
1 parent e1097e8 commit 400e179
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Service/BookSuggestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ public function getCategorySuggestions(Book $book): array
return $suggestions;
}
foreach ($results['docs'] as $result) {
foreach ($result['subject'] as $category) {
$suggestions['tags'][$category] = $category;
if(is_array($result['subject'])){
foreach ($result['subject'] as $category) {
$suggestions['tags'][$category] = $category;
}
}
}

Expand Down

0 comments on commit 400e179

Please sign in to comment.