Skip to content

Commit 0c6227e

Browse files
committed
Merge pull request #69 from wtfzdotnet/issue-56
Adding tv episode and tv season to find
2 parents b77383a + b870b53 commit 0c6227e

2 files changed

Lines changed: 99 additions & 3 deletions

File tree

lib/Tmdb/Factory/FindFactory.php

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ class FindFactory extends AbstractFactory
4343
*/
4444
public function __construct(HttpClient $httpClient)
4545
{
46-
$this->movieFactory = new MovieFactory($httpClient);
47-
$this->peopleFactory = new PeopleFactory($httpClient);
48-
$this->tvFactory = new TvFactory($httpClient);
46+
$this->movieFactory = new MovieFactory($httpClient);
47+
$this->peopleFactory = new PeopleFactory($httpClient);
48+
$this->tvFactory = new TvFactory($httpClient);
49+
$this->tvSeasonFactory = new TvFactory($httpClient);
50+
$this->tvEpisodeFactory = new TvEpisodeFactory($httpClient);
4951

5052
parent::__construct($httpClient);
5153
}
@@ -69,6 +71,14 @@ public function create(array $data = [])
6971
$find->setTvResults($this->getTvFactory()->createCollection($data['tv_results']));
7072
}
7173

74+
if (array_key_exists('tv_season_results', $data)) {
75+
$find->setTvSeasonResults($this->getTvSeasonFactory()->createCollection($data['tv_season_results']));
76+
}
77+
78+
if (array_key_exists('tv_episode_results', $data)) {
79+
$find->setTvEpisodeResults($this->getTvSeasonFactory()->createCollection($data['tv_episode_results']));
80+
}
81+
7282
return $find;
7383
}
7484

@@ -140,4 +150,42 @@ public function getTvFactory()
140150
{
141151
return $this->tvFactory;
142152
}
153+
154+
/**
155+
* @return TvEpisodeFactory
156+
*/
157+
public function getTvEpisodeFactory()
158+
{
159+
return $this->tvEpisodeFactory;
160+
}
161+
162+
/**
163+
* @param TvEpisodeFactory $tvEpisodeFactory
164+
* @return $this
165+
*/
166+
public function setTvEpisodeFactory($tvEpisodeFactory)
167+
{
168+
$this->tvEpisodeFactory = $tvEpisodeFactory;
169+
170+
return $this;
171+
}
172+
173+
/**
174+
* @return TvFactory
175+
*/
176+
public function getTvSeasonFactory()
177+
{
178+
return $this->tvSeasonFactory;
179+
}
180+
181+
/**
182+
* @param TvFactory $tvSeasonFactory
183+
* @return $this
184+
*/
185+
public function setTvSeasonFactory($tvSeasonFactory)
186+
{
187+
$this->tvSeasonFactory = $tvSeasonFactory;
188+
189+
return $this;
190+
}
143191
}

lib/Tmdb/Model/Find.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ class Find extends AbstractModel
3636
*/
3737
private $tvResults;
3838

39+
/**
40+
* @var GenericCollection
41+
*/
42+
private $tvSeasonResults;
43+
44+
/**
45+
* @var GenericCollection
46+
*/
47+
private $tvEpisodeResults;
48+
3949
/**
4050
* @param \Tmdb\Model\Common\GenericCollection $movieResults
4151
* @return $this
@@ -92,4 +102,42 @@ public function getTvResults()
92102
{
93103
return $this->tvResults;
94104
}
105+
106+
/**
107+
* @return GenericCollection
108+
*/
109+
public function getTvSeasonResults()
110+
{
111+
return $this->tvSeasonResults;
112+
}
113+
114+
/**
115+
* @param GenericCollection $tvSeasonResults
116+
* @return $this
117+
*/
118+
public function setTvSeasonResults($tvSeasonResults)
119+
{
120+
$this->tvSeasonResults = $tvSeasonResults;
121+
122+
return $this;
123+
}
124+
125+
/**
126+
* @return GenericCollection
127+
*/
128+
public function getTvEpisodeResults()
129+
{
130+
return $this->tvEpisodeResults;
131+
}
132+
133+
/**
134+
* @param GenericCollection $tvEpisodeResults
135+
* @return $this
136+
*/
137+
public function setTvEpisodeResults($tvEpisodeResults)
138+
{
139+
$this->tvEpisodeResults = $tvEpisodeResults;
140+
141+
return $this;
142+
}
95143
}

0 commit comments

Comments
 (0)