Skip to content

Commit

Permalink
Use id/name instead of providerID/providerName
Browse files Browse the repository at this point in the history
  • Loading branch information
neildaniels committed Aug 27, 2021
1 parent 8cbd7d7 commit ae365a7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
7 changes: 7 additions & 0 deletions lib/Tmdb/Factory/MovieFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ public function create(array $data = []): ?AbstractModel
foreach (['flatrate', 'rent', 'buy'] as $providerType) {
$typeProviders = new GenericCollection();
foreach ($country_watch_data[$providerType] ?? [] as $providerData) {
if (isset($providerData['provider_id'])) {
$providerData['id'] = $providerData['provider_id'];
}
if (isset($providerData['provider_name'])) {
$providerData['name'] = $providerData['provider_name'];
}

$providerData['iso_3166_1'] = $iso_31661;
$providerData['type'] = $providerType;
$typeProviders->add(null, $this->hydrate(new Watch\Provider(), $providerData));
Expand Down
7 changes: 7 additions & 0 deletions lib/Tmdb/Factory/TvFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ public function create(array $data = []): ?AbstractModel
foreach (['flatrate', 'rent', 'buy'] as $providerType) {
$typeProviders = new GenericCollection();
foreach ($country_watch_data[$providerType] ?? [] as $providerData) {
if (isset($providerData['provider_id'])) {
$providerData['id'] = $providerData['provider_id'];
}
if (isset($providerData['provider_name'])) {
$providerData['name'] = $providerData['provider_name'];
}

$providerData['iso_3166_1'] = $iso_31661;
$providerData['type'] = $providerType;
$typeProviders->add(null, $this->hydrate(new Watch\Provider(), $providerData));
Expand Down
28 changes: 14 additions & 14 deletions lib/Tmdb/Model/Watch/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ class Provider extends AbstractModel implements CountryFilter
{
public static $properties = [
'iso_3166_1',
'provider_id',
'provider_name',
'id',
'name',
'logo_path',
'display_priority',
'type'
];
private $iso31661;
private $providerID;
private $providerName;
private $id;
private $name;
private $logoPath;
private $displayPriority;
private $type;
Expand All @@ -60,37 +60,37 @@ public function setIso31661($iso31661)
/**
* @return int|null
*/
public function getProviderID()
public function getID()
{
return $this->providerID;
return $this->id;
}

/**
* @param int|null $providerID
* @param int|null $ID
* @return $this
*/
public function setProviderID($providerID)
public function setID($id)
{
$this->providerID = $providerID;
$this->id = $id;

return $this;
}

/**
* @return string|null
*/
public function getProviderName()
public function getName()
{
return $this->providerName;
return $this->Name;
}

/**
* @param string|null $providerName
* @param string|null $Name
* @return $this
*/
public function setProviderName($providerName)
public function setName($name)
{
$this->providerName = $providerName;
$this->name = $name;

return $this;
}
Expand Down

0 comments on commit ae365a7

Please sign in to comment.