Skip to content

Instantly share code, notes, and snippets.

@tab1293
Created February 16, 2016 21:22
Show Gist options
  • Save tab1293/0faa238d8df9cc84b482 to your computer and use it in GitHub Desktop.
Save tab1293/0faa238d8df9cc84b482 to your computer and use it in GitHub Desktop.
VOD Bundle and Content Rating Filter
<?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