diff --git a/lib/Tmdb/Factory/PeopleFactory.php b/lib/Tmdb/Factory/PeopleFactory.php index 9d326b2f..957cdf59 100644 --- a/lib/Tmdb/Factory/PeopleFactory.php +++ b/lib/Tmdb/Factory/PeopleFactory.php @@ -13,6 +13,7 @@ namespace Tmdb\Factory; use Tmdb\Common\ObjectHydrator; +use Tmdb\Factory\Common\ChangeFactory; use Tmdb\Model\Collection\People\Cast; use Tmdb\Model\Collection\People\Crew; use Tmdb\Model\Collection\People; @@ -26,12 +27,18 @@ class PeopleFactory extends AbstractFactory { */ private $imageFactory; + /** + * @var ChangeFactory + */ + private $changeFactory; + /** * Constructor */ public function __construct() { - $this->imageFactory = new ImageFactory(); + $this->imageFactory = new ImageFactory(); + $this->changeFactory = new ChangeFactory(); } /** @@ -67,6 +74,10 @@ public function create(array $data = array(), Person\AbstractMember $person = nu $this->applyCredits($data, $person); } + if (array_key_exists('changes', $data)) { + $person->setChanges($this->getChangeFactory()->createCollection($data['changes'])); + } + return $this->hydrate($person, $data); } @@ -140,4 +151,22 @@ public function getImageFactory() { return $this->imageFactory; } + + /** + * @param \Tmdb\Factory\Common\ChangeFactory $changeFactory + * @return $this + */ + public function setChangeFactory($changeFactory) + { + $this->changeFactory = $changeFactory; + return $this; + } + + /** + * @return \Tmdb\Factory\Common\ChangeFactory + */ + public function getChangeFactory() + { + return $this->changeFactory; + } }