Created
February 16, 2016 21:22
-
-
Save tab1293/0faa238d8df9cc84b482 to your computer and use it in GitHub Desktop.
VOD Bundle and Content Rating Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(dirname(__DIR__). '/scripts/vimeo.script.init.php'); | |
use Vimeo\Datasource\DsEquals; | |
use Vimeo\Datasource\DsBitwise; | |
VimeoApplication::startup(\VimeoApplication::MODE_WEB); | |
set_memory_limit(MEMORY_LIMIT_512M); | |
$bundle_id = APPLICATION_PRODUCTION ? OnDemandBundle::LOGGED_OUT_HOMEPAGE : OnDemandBundle::FEATURED; | |
$content_rating = Clip::RATING_SAFE; | |
// Set up datasource | |
$on_demand_table = OnDemand::getDatasource(); | |
// Join bundle table | |
$on_demand_bundle_table = OnDemandBundleVod::getDatasource(); | |
$join_predicate = new DsEquals($on_demand_table->id, $on_demand_bundle_table->on_demand_id); | |
$on_demand_table->innerJoin($on_demand_bundle_table, $join_predicate); | |
// Set where predicates | |
$content_rating_predicate = new DsEquals(new DsBitwise('&', $on_demand_table->content_rating, $content_rating), $on_demand_table->content_rating); | |
$bundle_predicate = new DsEquals($on_demand_bundle_table->bundle_id, $bundle_id); | |
$on_demand_table->where($content_rating_predicate)->where($bundle_predicate); | |
$ids = \dump($on_demand_table->fetchIds()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment