-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined index: movie_credits #57
Comments
Hey @omar-mohamed23 But yeah it is possible. But a little bit harder:
But attention: When you use the get() call you receive the API Response. Not Model Instances. You have to create Person instances manually with the correct data. For your mentioned error with your code: Look at my file:
Please look at the TMDB API Documentation. You are able to specify "extra fields" (like "movie_credits" for Persons). This extra fields are not send in the API Response by default. You have to manually specify them. If you want to call |
First thing Thanks for your fast reply :) |
Your code works. It loads only the Cast not the Crew. When want both try something like this:
I tried it with deadpool 2 and it renders every crew member and every actor in my case. As i mentioned in my previous comment you have to specify your "append to response"-fields for the tmdb api. That you can do in the default configuration (if you use it). But you are able to make something like this: This tells the API that you additionally want to get the movie_credits field for the person response. |
@bogdanfinn Really Thank you for your help |
Hi, is it possible to get cast and crew of movie Persons in the same function like getCredits(); ? I need to create a page with both cast and crew and the role of each person only ? also when I use this code to get all the cast member with their role on the movie it show me the first 40 correct with their role but then i get Undefined index: movie_credits & Invalid argument supplied for foreach() error. I'm still learning PHP so maybe I have approached the solution in a wrong way.
### The Error
Undefined index: movie_credits in /var/www/html/app/tmdb/controller/classes/data/Person.php on line 122
Warning: Invalid argument supplied for foreach() in /var/www/html/app/tmdb/controller/classes/data/Person.php on line 122
The text was updated successfully, but these errors were encountered: