Comments (11)
Hello @HellsAngels
where is the code provided you mentioned in the beginning? can't find it in the examples of this repository.
Nevertheless your code example and your error message are somehow not related.
In your code you iterate over the genres of a movie (when they exist) and print the name of the genre.
But your error message is for getting the Id of a Genre.
Maybe you can provide further details on what you are doing, how you are doing it and what you want to achieve?
from tmdb_v3-php-api-.
the error reports this code to me Genre.php line 49
return $this->_data['id'];
What I want to do is display the Genres. But in Movie.php this $this->_data['genres'] code gives me this error!
Undefined index: genres in C:\wamp64\www\tmdb_v3-PHP-API--master\controller\classes\data\Movie.php on line 106
And if I put this $ this->_data['genre_ids'] it is this error
Trying to access array offset on value of type int in C:\wamp64\www\tmdb_v3-PHP-API--master\controller\classes\data\Genre.php on line 49
And I call the genre like this
foreach($movie->getGenres() as $genre){
echo ''. $genre->getName() .'';
}
I do not know what to do. Yet your code works well except genres
from tmdb_v3-php-api-.
Is it the Detail of a Movie or for example a search result of a movie? Are you iterating over a movie list?
From which endpoint do you get your movie / movies?
For example when you first search for a movie by keyword and receive a movie list and then want to display the genres of each movie (search result) then you only have the genre ids.
Will look into this Genre thing and hopefully provide an example.
from tmdb_v3-php-api-.
It’s while searching for a movie, so it’s just the genre IDs that it displays ,? If so, what would be nice is that with genre IDs we can have a list of genres.
You were talking about it here (#40) and it is on this discussion that I tried to display the genres, but I had not seen that it was just on the info of a film and not the research
from tmdb_v3-php-api-.
@HellsAngels
You can have a look into the official API Docs.
Movie Details:
https://developers.themoviedb.org/3/movies/get-movie-details
Movies in Search Results:
https://developers.themoviedb.org/3/search/search-movies
Look into the Responses. There you will see that on the Details Endpoint you receive the Genres Array on the Search Endpoint only an Array of Genre Ids.
That means when you want to display each Genre Name for a Movie search result you have to iterate over the ids and fetch the genre details. Unfortunately there is currently no function for fetching Genre Details by Id.
from tmdb_v3-php-api-.
@HellsAngels
I added some examples for genres in my latest commit on my fork check them out:
https://github.com/bogdanfinn/tmdb_v3-PHP-API-
That means when you want to display each Genre Name for a Movie search result you have to iterate over the ids and fetch the genre details. Unfortunately there is currently no function for fetching Genre Details by Id.
But fetchig the genre details is only one API call. See the examples. then you receive a list of genres and you only need to filter the genres you are intereted in. You dont have to do an api call for each genre
from tmdb_v3-php-api-.
Ok thank you I will go see the details of the API. And sorry for the inconvenience because actually during the search we only have the gender IDs.
from tmdb_v3-php-api-.
@bogdanfinn Can you do a pull request?
from tmdb_v3-php-api-.
@pixelead0 created one for all 3 open issues
from tmdb_v3-php-api-.
@pixelead0 issue can be closed
from tmdb_v3-php-api-.
thanks @bogdanfinn
from tmdb_v3-php-api-.
Related Issues (20)
- How to get Movie/TV/Person search page ? HOT 2
- No ../tmdb-api.php file included, on this code HOT 1
- Errer Showing HOT 16
- Empty youtube video problem HOT 5
- how to show movie certification HOT 3
- setAPIKey not working
- Trailer in TV Show HOT 3
- Num of episodes in seasons loop HOT 3
- episodes images not working HOT 1
- I cant get the backdrop HOT 1
- getImageURL not working
- Get Production (Aired) Year for TV Show
- How do I get the [character] each actor played in the movie??
- Auto suggest in search
- A missed quote in README.markdown
- imdb tv id get data not working
- this genre data
- Error Handler
- please insert RatedMovies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmdb_v3-php-api-.