diff --git a/lib/Tmdb/Factory/People/CastFactory.php b/lib/Tmdb/Factory/People/CastFactory.php index dfbc8d86..97d17275 100644 --- a/lib/Tmdb/Factory/People/CastFactory.php +++ b/lib/Tmdb/Factory/People/CastFactory.php @@ -27,13 +27,18 @@ public function create(array $data = array(), $person = null) /** * {@inheritdoc} - * @param \Tmdb\Model\Tv\Person\CastMember $person + * @param \Tmdb\Model\Person\CastMember $person */ public function createCollection(array $data = array(), $person = null) { $collection = new Cast(); - $class = get_class($person); + if (is_object($person)) { + $class = get_class($person); + } + else{ + $class = '\Tmdb\Model\Person\CastMember'; + } foreach($data as $item) { $collection->add(null, $this->create($item, new $class())); diff --git a/lib/Tmdb/Factory/People/CrewFactory.php b/lib/Tmdb/Factory/People/CrewFactory.php index e5015493..68fc6d1a 100644 --- a/lib/Tmdb/Factory/People/CrewFactory.php +++ b/lib/Tmdb/Factory/People/CrewFactory.php @@ -27,13 +27,18 @@ public function create(array $data = array(), $person = null) /** * {@inheritdoc} - * @param \Tmdb\Model\Tv\Person\CrewMember $person + * @param \Tmdb\Model\Person\CrewMember $person */ public function createCollection(array $data = array(), $person = null) { $collection = new Crew(); - $class = get_class($person); + if (is_object($person)) { + $class = get_class($person); + } + else{ + $class = '\Tmdb\Model\Person\CrewMember'; + } foreach($data as $item) { $collection->add(null, $this->create($item, new $class())); diff --git a/lib/Tmdb/Factory/PeopleFactory.php b/lib/Tmdb/Factory/PeopleFactory.php index 61332812..4b0bedf0 100644 --- a/lib/Tmdb/Factory/PeopleFactory.php +++ b/lib/Tmdb/Factory/PeopleFactory.php @@ -48,7 +48,7 @@ public function __construct() * * @return Person|CrewMember|CastMember */ - public function create(array $data = array(), Person\AbstractMember $person = null) + public function create(array $data = array(), $person = null) { if (!is_object($person)) { if (array_key_exists('character', $data)) { @@ -143,7 +143,7 @@ protected function getPosterImageForCredit($posterPath) /** * {@inheritdoc} */ - public function createCollection(array $data = array(), Person\AbstractMember $person = null, $collection = null) + public function createCollection(array $data = array(), $person = null, $collection = null) { if (!$collection) { $collection = new People(); @@ -153,7 +153,12 @@ public function createCollection(array $data = array(), Person\AbstractMember $p $data = $data['results']; } - $class = get_class($person); + if (is_object($person)) { + $class = get_class($person); + } + else{ + $class = '\Tmdb\Model\Person'; + } foreach($data as $item) { $collection->add(null, $this->create($item, new $class()));