diff --git a/lib/Tmdb/Factory/PeopleFactory.php b/lib/Tmdb/Factory/PeopleFactory.php index 957cdf59..c61e2153 100644 --- a/lib/Tmdb/Factory/PeopleFactory.php +++ b/lib/Tmdb/Factory/PeopleFactory.php @@ -17,6 +17,7 @@ use Tmdb\Model\Collection\People\Cast; use Tmdb\Model\Collection\People\Crew; use Tmdb\Model\Collection\People; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Person\CastMember; use Tmdb\Model\Person\CrewMember; use Tmdb\Model\Person; @@ -78,6 +79,13 @@ public function create(array $data = array(), Person\AbstractMember $person = nu $person->setChanges($this->getChangeFactory()->createCollection($data['changes'])); } + /** External ids */ + if (array_key_exists('external_ids', $data)) { + $person->setExternalIds( + $this->hydrate(new ExternalIds(), $data['external_ids']) + ); + } + return $this->hydrate($person, $data); } diff --git a/lib/Tmdb/Factory/TvEpisodeFactory.php b/lib/Tmdb/Factory/TvEpisodeFactory.php index 56b0eb8d..b665bea0 100644 --- a/lib/Tmdb/Factory/TvEpisodeFactory.php +++ b/lib/Tmdb/Factory/TvEpisodeFactory.php @@ -17,7 +17,7 @@ use Tmdb\Model\Common\GenericCollection; use Tmdb\Model\Person\CastMember; use Tmdb\Model\Person\CrewMember; -use Tmdb\Model\Tv\ExternalIds; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Tv\Episode; class TvEpisodeFactory extends AbstractFactory { diff --git a/lib/Tmdb/Factory/TvFactory.php b/lib/Tmdb/Factory/TvFactory.php index 91b8ca5b..08c07c2c 100644 --- a/lib/Tmdb/Factory/TvFactory.php +++ b/lib/Tmdb/Factory/TvFactory.php @@ -18,7 +18,7 @@ use Tmdb\Model\Common\Translation; use Tmdb\Model\Person\CastMember; use Tmdb\Model\Person\CrewMember; -use Tmdb\Model\Tv\ExternalIds; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Tv; class TvFactory extends AbstractFactory { diff --git a/lib/Tmdb/Factory/TvSeasonFactory.php b/lib/Tmdb/Factory/TvSeasonFactory.php index f13ea363..e18313ed 100644 --- a/lib/Tmdb/Factory/TvSeasonFactory.php +++ b/lib/Tmdb/Factory/TvSeasonFactory.php @@ -17,7 +17,7 @@ use Tmdb\Model\Common\GenericCollection; use Tmdb\Model\Person\CastMember; use Tmdb\Model\Person\CrewMember; -use Tmdb\Model\Tv\ExternalIds; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Tv\Season; class TvSeasonFactory extends AbstractFactory { diff --git a/lib/Tmdb/Model/Tv/ExternalIds.php b/lib/Tmdb/Model/Common/ExternalIds.php similarity index 98% rename from lib/Tmdb/Model/Tv/ExternalIds.php rename to lib/Tmdb/Model/Common/ExternalIds.php index e7924709..fe593089 100644 --- a/lib/Tmdb/Model/Tv/ExternalIds.php +++ b/lib/Tmdb/Model/Common/ExternalIds.php @@ -10,7 +10,7 @@ * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ -namespace Tmdb\Model\Tv; +namespace Tmdb\Model\Common; use Tmdb\Model\AbstractModel; diff --git a/lib/Tmdb/Model/Person.php b/lib/Tmdb/Model/Person.php index ed643a32..adb9a357 100644 --- a/lib/Tmdb/Model/Person.php +++ b/lib/Tmdb/Model/Person.php @@ -13,6 +13,7 @@ namespace Tmdb\Model; use Tmdb\Model\Collection\Credits; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Common\GenericCollection; use Tmdb\Model\Collection\Images; use Tmdb\Model\Collection\People\PersonInterface; @@ -105,6 +106,13 @@ class Person extends AbstractModel implements PersonInterface { */ protected $changes; + /** + * External Ids + * + * @var ExternalIds + */ + protected $externalIds; + public static $_properties = array( 'adult', 'also_known_as', @@ -131,6 +139,7 @@ public function __construct() $this->combinedCredits = new Credits\CombinedCredits(); $this->images = new Images(); $this->changes = new GenericCollection(); + $this->externalIds = new ExternalIds(); } /** @@ -450,4 +459,22 @@ public function getTvCredits() { return $this->tvCredits; } + + /** + * @param \Tmdb\Model\Common\ExternalIds $externalIds + * @return $this + */ + public function setExternalIds($externalIds) + { + $this->externalIds = $externalIds; + return $this; + } + + /** + * @return \Tmdb\Model\Common\ExternalIds + */ + public function getExternalIds() + { + return $this->externalIds; + } } diff --git a/lib/Tmdb/Model/Tv.php b/lib/Tmdb/Model/Tv.php index f47623d6..edb5f8a5 100644 --- a/lib/Tmdb/Model/Tv.php +++ b/lib/Tmdb/Model/Tv.php @@ -18,7 +18,7 @@ use Tmdb\Model\Collection\Images; use Tmdb\Model\Image\BackdropImage; use Tmdb\Model\Image\PosterImage; -use Tmdb\Model\Tv\ExternalIds; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Tv\Network; class Tv extends AbstractModel { @@ -688,7 +688,7 @@ public function getImages() } /** - * @param \Tmdb\Model\Tv\ExternalIds $externalIds + * @param \Tmdb\Model\Common\ExternalIds $externalIds * @return $this */ public function setExternalIds($externalIds) @@ -698,7 +698,7 @@ public function setExternalIds($externalIds) } /** - * @return \Tmdb\Model\Tv\ExternalIds + * @return \Tmdb\Model\Common\ExternalIds */ public function getExternalIds() { diff --git a/lib/Tmdb/Model/Tv/Episode.php b/lib/Tmdb/Model/Tv/Episode.php index c4e0fb24..29c2450f 100644 --- a/lib/Tmdb/Model/Tv/Episode.php +++ b/lib/Tmdb/Model/Tv/Episode.php @@ -15,6 +15,7 @@ use Tmdb\Model\AbstractModel; use Tmdb\Model\Collection\Credits; use Tmdb\Model\Collection\Images; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Image\StillImage; class Episode extends AbstractModel { diff --git a/lib/Tmdb/Model/Tv/Season.php b/lib/Tmdb/Model/Tv/Season.php index 4d3adc25..f90c56fc 100644 --- a/lib/Tmdb/Model/Tv/Season.php +++ b/lib/Tmdb/Model/Tv/Season.php @@ -15,6 +15,7 @@ use Tmdb\Model\AbstractModel; use Tmdb\Model\Collection\Credits; use Tmdb\Model\Collection\Images; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Common\GenericCollection; use Tmdb\Model\Image\PosterImage; @@ -253,7 +254,7 @@ public function getCredits() } /** - * @param \Tmdb\Model\Tv\ExternalIds $externalIds + * @param \Tmdb\Model\Common\ExternalIds $externalIds * @return $this */ public function setExternalIds($externalIds) @@ -263,7 +264,7 @@ public function setExternalIds($externalIds) } /** - * @return \Tmdb\Model\Tv\ExternalIds + * @return \Tmdb\Model\Common\ExternalIds */ public function getExternalIds() { diff --git a/test/Tmdb/Tests/Factory/TvEpisodeFactoryTest.php b/test/Tmdb/Tests/Factory/TvEpisodeFactoryTest.php index 3e6c4cf3..1f28b000 100644 --- a/test/Tmdb/Tests/Factory/TvEpisodeFactoryTest.php +++ b/test/Tmdb/Tests/Factory/TvEpisodeFactoryTest.php @@ -46,7 +46,7 @@ public function shouldConstructTvEpisode() $this->assertInstanceOf('\DateTime', $this->episode->getAirDate()); $this->assertInstanceOf('Tmdb\Model\Collection\Credits', $this->episode->getCredits()); - $this->assertInstanceOf('Tmdb\Model\Tv\ExternalIds', $this->episode->getExternalIds()); + $this->assertInstanceOf('Tmdb\Model\Common\ExternalIds', $this->episode->getExternalIds()); $this->assertInstanceOf('Tmdb\Model\Collection\Images', $this->episode->getImages()); $this->assertInstanceOf('Tmdb\Model\Image\StillImage', $this->episode->getStillImage()); } diff --git a/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php b/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php index 9f54a2f9..e3776ebc 100644 --- a/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php +++ b/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php @@ -46,7 +46,7 @@ public function shouldConstructTvSeason() $this->assertInstanceOf('\DateTime', $this->season->getAirDate()); $this->assertInstanceOf('Tmdb\Model\Collection\Credits', $this->season->getCredits()); - $this->assertInstanceOf('Tmdb\Model\Tv\ExternalIds', $this->season->getExternalIds()); + $this->assertInstanceOf('Tmdb\Model\Common\ExternalIds', $this->season->getExternalIds()); $this->assertInstanceOf('Tmdb\Model\Collection\Images', $this->season->getImages()); $this->assertInstanceOf('Tmdb\Model\Common\GenericCollection', $this->season->getEpisodes()); $this->assertInstanceOf('Tmdb\Model\Image\PosterImage', $this->season->getPosterImage()); diff --git a/test/Tmdb/Tests/Model/Tv/EpisodeTest.php b/test/Tmdb/Tests/Model/Tv/EpisodeTest.php index 005aa743..3e934818 100644 --- a/test/Tmdb/Tests/Model/Tv/EpisodeTest.php +++ b/test/Tmdb/Tests/Model/Tv/EpisodeTest.php @@ -28,7 +28,7 @@ public function shouldConstructTvEpisode() $episode, array( 'getCredits' => 'Tmdb\Model\Collection\Credits', - 'getExternalIds' => 'Tmdb\Model\Tv\ExternalIds', + 'getExternalIds' => 'Tmdb\Model\Common\ExternalIds', 'getImages' => 'Tmdb\Model\Collection\Images', ) ); diff --git a/test/Tmdb/Tests/Model/Tv/ExternalIdsTest.php b/test/Tmdb/Tests/Model/Tv/ExternalIdsTest.php index 6dcb2888..fcc3ce7a 100644 --- a/test/Tmdb/Tests/Model/Tv/ExternalIdsTest.php +++ b/test/Tmdb/Tests/Model/Tv/ExternalIdsTest.php @@ -13,7 +13,7 @@ namespace Tmdb\Tests\Model\Tv; use Tmdb\Common\ObjectHydrator; -use Tmdb\Model\Tv\ExternalIds; +use Tmdb\Model\Common\ExternalIds; use Tmdb\Tests\Model\TestCase; class ExternalIdsTest extends TestCase diff --git a/test/Tmdb/Tests/Model/Tv/SeasonTest.php b/test/Tmdb/Tests/Model/Tv/SeasonTest.php index 0e5b87ea..208d6832 100644 --- a/test/Tmdb/Tests/Model/Tv/SeasonTest.php +++ b/test/Tmdb/Tests/Model/Tv/SeasonTest.php @@ -28,7 +28,7 @@ public function shouldConstructTvSeason() $season, array( 'getCredits' => 'Tmdb\Model\Collection\Credits', - 'getExternalIds' => 'Tmdb\Model\Tv\ExternalIds', + 'getExternalIds' => 'Tmdb\Model\Common\ExternalIds', 'getImages' => 'Tmdb\Model\Collection\Images', 'getEpisodes' => 'Tmdb\Model\Common\GenericCollection', ) diff --git a/test/Tmdb/Tests/Model/TvTest.php b/test/Tmdb/Tests/Model/TvTest.php index 512c44e1..613c9427 100644 --- a/test/Tmdb/Tests/Model/TvTest.php +++ b/test/Tmdb/Tests/Model/TvTest.php @@ -34,7 +34,7 @@ public function shouldConstructMovie() 'getOriginCountry' => 'Tmdb\Model\Common\GenericCollection', 'getSeasons' => 'Tmdb\Model\Common\GenericCollection', 'getCredits' => 'Tmdb\Model\Collection\Credits', - 'getExternalIds' => 'Tmdb\Model\Tv\ExternalIds', + 'getExternalIds' => 'Tmdb\Model\Common\ExternalIds', 'getImages' => 'Tmdb\Model\Collection\Images', 'getTranslations' => 'Tmdb\Model\Common\GenericCollection', )