From c81e0c78fb89ed5fd0b64b4cb4cb38ee75ea3f57 Mon Sep 17 00:00:00 2001 From: Michael Roterman Date: Sun, 2 Feb 2014 14:28:26 +0100 Subject: [PATCH] Cleaning up the Generic Collection factory --- lib/Tmdb/Factory/Common/GenericCollectionFactory.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Tmdb/Factory/Common/GenericCollectionFactory.php b/lib/Tmdb/Factory/Common/GenericCollectionFactory.php index 66cea81d..90cf3ce2 100644 --- a/lib/Tmdb/Factory/Common/GenericCollectionFactory.php +++ b/lib/Tmdb/Factory/Common/GenericCollectionFactory.php @@ -43,10 +43,11 @@ public function createCollection(array $data = array(), $class) $class = get_class($class); } - $collection = new GenericCollection(); + $collection = new GenericCollection(); + $objectHydrator = new ObjectHydrator(); foreach($data as $item) { - $collection->add(null, ObjectHydrator::hydrate(new $class(), $item)); + $collection->add(null, $objectHydrator->hydrate(new $class(), $item)); } return $collection;