diff --git a/lib/Tmdb/Factory/MovieFactory.php b/lib/Tmdb/Factory/MovieFactory.php index b14f31a0..dac55bc5 100644 --- a/lib/Tmdb/Factory/MovieFactory.php +++ b/lib/Tmdb/Factory/MovieFactory.php @@ -153,11 +153,11 @@ public function create(array $data = array()) } if (array_key_exists('reviews', $data)) { - $movie->setReviews($this->getReviewFactory()->createCollection($data['reviews'])); + $movie->setReviews($this->getReviewFactory()->createResultCollection($data['reviews'])); } if (array_key_exists('lists', $data)) { - $movie->setLists($this->getListItemFactory()->createCollection($data['lists'])); + $movie->setLists($this->getListItemFactory()->createResultCollection($data['lists'])); } if (array_key_exists('changes', $data)) { diff --git a/lib/Tmdb/Repository/ChangesRepository.php b/lib/Tmdb/Repository/ChangesRepository.php index aa929567..a2e34f03 100644 --- a/lib/Tmdb/Repository/ChangesRepository.php +++ b/lib/Tmdb/Repository/ChangesRepository.php @@ -39,7 +39,7 @@ class ChangesRepository extends AbstractRepository { public function getMovieChanges(ChangesQuery $query, array $headers = array()) { $data = $this->getApi()->getMovieChanges($query->toArray(), $headers); - return $this->getFactory()->createCollection($data); + return $this->getFactory()->createResultCollection($data); } /** @@ -59,7 +59,7 @@ public function getMovieChanges(ChangesQuery $query, array $headers = array()) { public function getPeopleChanges(ChangesQuery $query, array $headers = array()) { $data = $this->getApi()->getPersonChanges($query->toArray(), $headers); - return $this->getFactory()->createCollection($data); + return $this->getFactory()->createResultCollection($data); } /** diff --git a/lib/Tmdb/Repository/CompanyRepository.php b/lib/Tmdb/Repository/CompanyRepository.php index c79a98b8..76d09e2d 100644 --- a/lib/Tmdb/Repository/CompanyRepository.php +++ b/lib/Tmdb/Repository/CompanyRepository.php @@ -14,6 +14,7 @@ use Tmdb\Factory\CompanyFactory; use Tmdb\Factory\MovieFactory; +use Tmdb\Model\Collection\ResultCollection; use Tmdb\Model\Common\GenericCollection; use Tmdb\Model\Company; use Tmdb\Model\Movie; @@ -87,7 +88,7 @@ public function getMovieFactory() * @return Movie[] */ public function createMovieCollection($data){ - $collection = new GenericCollection(); + $collection = new ResultCollection(); if (array_key_exists('results', $data)) { $data = $data['results']; diff --git a/lib/Tmdb/Repository/MovieRepository.php b/lib/Tmdb/Repository/MovieRepository.php index 3216ab23..37288a2c 100644 --- a/lib/Tmdb/Repository/MovieRepository.php +++ b/lib/Tmdb/Repository/MovieRepository.php @@ -282,7 +282,7 @@ public function getLatest(array $options = array()) */ public function getUpcoming(array $options = array()) { - return $this->createCollection( + return $this->getFactory()->createResultCollection( $this->getApi()->getUpcoming($options) ); } @@ -295,7 +295,7 @@ public function getUpcoming(array $options = array()) */ public function getNowPlaying(array $options = array()) { - return $this->createCollection( + return $this->getFactory()->createResultCollection( $this->getApi()->getNowPlaying($options) ); } diff --git a/lib/Tmdb/Repository/PeopleRepository.php b/lib/Tmdb/Repository/PeopleRepository.php index 2157e8b4..f131ea8c 100644 --- a/lib/Tmdb/Repository/PeopleRepository.php +++ b/lib/Tmdb/Repository/PeopleRepository.php @@ -20,6 +20,8 @@ * Class PeopleRepository * @package Tmdb\Repository * @see http://docs.themoviedb.apiary.io/#people + * + * @todo implement the new methods */ class PeopleRepository extends AbstractRepository { /** diff --git a/lib/Tmdb/Repository/SearchRepository.php b/lib/Tmdb/Repository/SearchRepository.php index 43faf608..12352cc4 100644 --- a/lib/Tmdb/Repository/SearchRepository.php +++ b/lib/Tmdb/Repository/SearchRepository.php @@ -185,6 +185,12 @@ public function searchKeyword($query, KeywordSearchQuery $parameters, array $hea return $this->getKeywordFactory()->createResultCollection($data); } + /** + * Convert parameters back to an array + * + * @param array $parameters + * @return array + */ private function getParameters($parameters = array()) { if ($parameters instanceof SearchQuery) { return $parameters->toArray(); diff --git a/lib/Tmdb/Repository/TvRepository.php b/lib/Tmdb/Repository/TvRepository.php index 32057942..d455c801 100644 --- a/lib/Tmdb/Repository/TvRepository.php +++ b/lib/Tmdb/Repository/TvRepository.php @@ -176,16 +176,4 @@ public function getOnTheAir(array $options = array()) $this->getApi()->getTopRated($options) ); } - - /** - * Create an collection of an array - * - * @todo Allow an array of Tv objects to pass ( custom collection ) - * - * @param $data - * @return Tv[] - */ - private function createCollection($data){ - return $this->getFactory()->createCollection($data); - } }