diff --git a/lib/Tmdb/Factory/People/CastFactory.php b/lib/Tmdb/Factory/People/CastFactory.php index 87dd43f6..dfbc8d86 100644 --- a/lib/Tmdb/Factory/People/CastFactory.php +++ b/lib/Tmdb/Factory/People/CastFactory.php @@ -33,8 +33,10 @@ public function createCollection(array $data = array(), $person = null) { $collection = new Cast(); + $class = get_class($person); + foreach($data as $item) { - $collection->add(null, $this->create($item, $person)); + $collection->add(null, $this->create($item, new $class())); } return $collection; diff --git a/lib/Tmdb/Factory/People/CrewFactory.php b/lib/Tmdb/Factory/People/CrewFactory.php index deab2ffb..e5015493 100644 --- a/lib/Tmdb/Factory/People/CrewFactory.php +++ b/lib/Tmdb/Factory/People/CrewFactory.php @@ -33,8 +33,10 @@ public function createCollection(array $data = array(), $person = null) { $collection = new Crew(); + $class = get_class($person); + foreach($data as $item) { - $collection->add(null, $this->create($item, $person)); + $collection->add(null, $this->create($item, new $class())); } return $collection;