Skip to content

Commit

Permalink
Adding NetworkFactory to TvFactory and removing networks from the $_p…
Browse files Browse the repository at this point in the history
…roperties array to prevent regular hydration.
  • Loading branch information
wtfzdotnet committed Feb 8, 2014
1 parent f50bf6f commit abe4a48
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ The states for now defined as;
| Movies | Partially Done * |
| Networks | Done |
| People | Done |
| Reviews | Review |
| Reviews | Done |
| Search | **TODO** |
| TV | Review |
| TV | Done |
| TV Seasons | Review |
| TV Episodes | Review |

Expand Down
26 changes: 25 additions & 1 deletion lib/Tmdb/Factory/TvFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class TvFactory extends AbstractFactory {
*/
private $tvSeasonFactory;

/**
* @var NetworkFactory
*/
private $networkFactory;

/**
* Constructor
*/
Expand All @@ -57,6 +62,7 @@ public function __construct()
$this->genreFactory = new GenreFactory();
$this->imageFactory = new ImageFactory();
$this->tvSeasonFactory = new TvSeasonFactory();
$this->networkFactory = new NetworkFactory();
}

/**
Expand Down Expand Up @@ -117,7 +123,7 @@ public function create(array $data = array())

/** Networks */
if (array_key_exists('networks', $data)) {
$tvShow->setNetworks($this->createGenericCollection($data['networks'], new Tv\Network()));
$tvShow->setNetworks($this->getNetworkFactory()->createCollection($data['networks']));
}

return $this->hydrate($tvShow, $data);
Expand Down Expand Up @@ -230,4 +236,22 @@ public function getTvSeasonFactory()
{
return $this->tvSeasonFactory;
}

/**
* @param \Tmdb\Factory\NetworkFactory $networkFactory
* @return $this
*/
public function setNetworkFactory($networkFactory)
{
$this->networkFactory = $networkFactory;
return $this;
}

/**
* @return \Tmdb\Factory\NetworkFactory
*/
public function getNetworkFactory()
{
return $this->networkFactory;
}
}
2 changes: 0 additions & 2 deletions lib/Tmdb/Model/Tv.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ class Tv extends AbstractModel {
'languages',
'last_air_date',
'name',
//@todo remove networks
'networks',
'number_of_episodes',
'number_of_seasons',
'original_name',
Expand Down

0 comments on commit abe4a48

Please sign in to comment.