Skip to content

Commit d9d7ecf

Browse files
committed
Merge pull request #70 from wtfzdotnet/issue-57
Person and tv related issues
2 parents 0c6227e + c69d9dc commit d9d7ecf

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

lib/Tmdb/Factory/TvFactory.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Tmdb\Model\Common\GenericCollection;
2222
use Tmdb\Model\Common\SpokenLanguage;
2323
use Tmdb\Model\Common\Translation;
24+
use Tmdb\Model\Company;
2425
use Tmdb\Model\Person\CastMember;
2526
use Tmdb\Model\Person\CrewMember;
2627
use Tmdb\Model\Common\ExternalIds;
@@ -227,6 +228,12 @@ public function create(array $data = [])
227228
$tvShow->setOriginCountry($collection);
228229
}
229230

231+
if (array_key_exists('production_companies', $data)) {
232+
$tvShow->setProductionCompanies(
233+
$this->createGenericCollection($data['production_companies'], new Company())
234+
);
235+
}
236+
230237
if (array_key_exists('created_by', $data) && $data['created_by'] !== null) {
231238
$collection = new GenericCollection();
232239
$factory = new PeopleFactory($this->getHttpClient());

lib/Tmdb/Model/Tv.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ class Tv extends AbstractModel
200200
*/
201201
protected $similar;
202202

203+
/**
204+
* @var GenericCollection
205+
*/
206+
protected $productionCompanies;
207+
203208
/**
204209
* Properties that are available in the API
205210
*
@@ -883,4 +888,23 @@ public function getSimilar()
883888
{
884889
return $this->similar;
885890
}
891+
892+
/**
893+
* @return GenericCollection
894+
*/
895+
public function getProductionCompanies()
896+
{
897+
return $this->productionCompanies;
898+
}
899+
900+
/**
901+
* @param GenericCollection $productionCompanies
902+
* @return $this
903+
*/
904+
public function setProductionCompanies($productionCompanies)
905+
{
906+
$this->productionCompanies = $productionCompanies;
907+
908+
return $this;
909+
}
886910
}

0 commit comments

Comments
 (0)