diff --git a/examples/people/model/external_ids.php b/examples/people/model/external_ids.php new file mode 100644 index 00000000..76fa3fa3 --- /dev/null +++ b/examples/people/model/external_ids.php @@ -0,0 +1,22 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +require_once('../../../vendor/autoload.php'); +require_once('../../../apikey.php'); + +$token = new \Tmdb\ApiToken(TMDB_API_KEY); +$client = new \Tmdb\Client($token); + +$repository = new \Tmdb\Repository\PeopleRepository($client); +$externalIds = $repository->getExternalIds(287); + +var_dump($externalIds); \ No newline at end of file diff --git a/examples/people/model/latest.php b/examples/people/model/latest.php new file mode 100644 index 00000000..54015664 --- /dev/null +++ b/examples/people/model/latest.php @@ -0,0 +1,22 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +require_once('../../../vendor/autoload.php'); +require_once('../../../apikey.php'); + +$token = new \Tmdb\ApiToken(TMDB_API_KEY); +$client = new \Tmdb\Client($token); + +$repository = new \Tmdb\Repository\PeopleRepository($client); +$latest = $repository->getLatest(); + +var_dump($latest); \ No newline at end of file diff --git a/examples/people/model/popular.php b/examples/people/model/popular.php new file mode 100644 index 00000000..3d348597 --- /dev/null +++ b/examples/people/model/popular.php @@ -0,0 +1,22 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +require_once('../../../vendor/autoload.php'); +require_once('../../../apikey.php'); + +$token = new \Tmdb\ApiToken(TMDB_API_KEY); +$client = new \Tmdb\Client($token); + +$repository = new \Tmdb\Repository\PeopleRepository($client); +$popular = $repository->getPopular(); + +var_dump($popular); \ No newline at end of file diff --git a/lib/Tmdb/Api/People.php b/lib/Tmdb/Api/People.php index 9db1b2c9..466e2220 100644 --- a/lib/Tmdb/Api/People.php +++ b/lib/Tmdb/Api/People.php @@ -123,6 +123,19 @@ public function getChanges($person_id, array $parameters = array(), array $heade return $this->get('person/' . $person_id . '/changes', $parameters, $headers); } + /** + * Get the external ids for a specific person id. + * + * @param $person_id + * @param array $parameters + * @param array $headers + * @return mixed + */ + public function getExternalIds($person_id, array $parameters = array(), array $headers = array()) + { + return $this->get('person/' . $person_id . '/external_ids', $parameters, $headers); + } + /** * Get the list of popular people on The Movie Database. This list refreshes every day. * @@ -138,12 +151,10 @@ public function getPopular(array $parameters = array(), array $headers = array() /** * Get the latest person id. * - * @param array $parameters - * @param array $headers * @return mixed */ - public function getLatest(array $parameters = array(), array $headers = array()) + public function getLatest() { - return $this->get('person/latest', $parameters, $headers); + return $this->get('person/latest'); } } diff --git a/lib/Tmdb/Repository/PeopleRepository.php b/lib/Tmdb/Repository/PeopleRepository.php index 72e41622..f9fcf4b3 100644 --- a/lib/Tmdb/Repository/PeopleRepository.php +++ b/lib/Tmdb/Repository/PeopleRepository.php @@ -114,7 +114,7 @@ public function getCombinedCredits($id, array $parameters = array(), array $head */ public function getExternalIds($id) { - $data = $this->getApi()->getCombinedCredits($id); + $data = $this->getApi()->getExternalIds($id); $person = $this->getFactory()->create(array('external_ids' => $data)); return $person->getExternalIds(); @@ -161,11 +161,13 @@ public function getChanges($id, array $parameters = array(), array $headers = ar * * This list refreshes every day. * + * @param array $parameters + * @param array $headers * @return null|\Tmdb\Model\AbstractModel */ - public function getPopular() + public function getPopular(array $parameters = array(), array $headers = array()) { - $data = $this->getApi()->getPopular(); + $data = $this->getApi()->getPopular($parameters, $headers); return $this->getFactory()->createResultCollection($data); }