Skip to content

Commit 6b4ae43

Browse files
committed
Adding patch to fix the incorrect genres collection for popular queries for TV shows as well.
1 parent 106fe78 commit 6b4ae43

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/Tmdb/Factory/TvFactory.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,19 @@ public function create(array $data = [])
154154
$tvShow->setGenres($this->getGenreFactory()->createCollection($data['genres']));
155155
}
156156

157+
/** Genres */
158+
if (array_key_exists('genre_ids', $data)) {
159+
$formattedData = [];
160+
161+
foreach ($data['genre_ids'] as $genreId) {
162+
$formattedData[] = [
163+
'id' => $genreId
164+
];
165+
}
166+
167+
$tvShow->setGenres($this->getGenreFactory()->createCollection($formattedData));
168+
}
169+
157170
/** Images */
158171
if (array_key_exists('images', $data) && $data['images'] !== null) {
159172
$tvShow->setImages(

0 commit comments

Comments
 (0)