Skip to content

Commit

Permalink
Adding changes to People
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Feb 8, 2014
1 parent 3dec74d commit 38ce990
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion lib/Tmdb/Factory/PeopleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

/**
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}
}

0 comments on commit 38ce990

Please sign in to comment.