Closed orig921 closed 6 years ago
The $movie->getGenres()
function returns an array of Genre
Objects or null
.
You have to iterate over the array and build the link yourself. For example:
foreach($movie->getGenres() as $genre){ echo '<a href="https://www.themoviedb.org/genre/'.$genre->getId().'">'. $genre->getName() .'</a>'; }
As far as i know you only get the Genres when you request Information for a specific movie. When you try to call $movie->getGenres() on a $movie object in a search result list for example the property genres does not exist.
Hope i could help you :)
Hi! I tried: "echo $movie->getGenres()" and a got: "Array". How can I list genres of a link as a link? I want to list genres names as a link. The link href is the genre id.