Skip to content

Commit 322a2a0

Browse files
committed
Include normalize function
1 parent ddae50d commit 322a2a0

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
namespace Tmdb\Model\Query\Discover;
1616

1717
use DateTime;
18+
use Tmdb\Model\AbstractModel;
1819
use Tmdb\Model\Collection\QueryParametersCollection;
1920

2021
/**
@@ -314,4 +315,19 @@ public function withNetworksAnd(array $networks = [])
314315
implode(',', $networks)
315316
);
316317
}
318+
319+
/**
320+
* Extract object id's if an collection was passed on.
321+
*
322+
* @param $mixed
323+
* @return mixed
324+
*/
325+
protected function normalize($mixed)
326+
{
327+
if (is_object($mixed) && $mixed instanceof AbstractModel) {
328+
return $mixed->getId();
329+
}
330+
331+
return $mixed;
332+
}
317333
}

0 commit comments

Comments
 (0)