예제 #1
0
 /**
  * Get web playable Flavor Assets for Entry
  * 
  * @action getWebPlayableByEntryId
  * @param string $entryId
  * @return KalturaFlavorAssetArray
  */
 public function getWebPlayableByEntryIdAction($entryId)
 {
     // entry could be "display_in_search = 2" - in that case we want to pull it although KN is off in services.ct for this action
     $c = new Criteria();
     $c->addAnd(entryPeer::ID, $entryId);
     $criterionPartnerOrKn = $c->getNewCriterion(entryPeer::PARTNER_ID, $this->getPartnerId());
     $criterionPartnerOrKn->addOr($c->getNewCriterion(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK));
     $c->addAnd($criterionPartnerOrKn);
     // there could only be one entry because the query is by primary key.
     // so using doSelectOne is safe.
     $dbEntry = entryPeer::doSelectOne($c);
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     // if the entry does not belong to the partner but "display_in_search = 2"
     // we want to turn off the criteria over the flavorAssetPeer
     if ($dbEntry->getPartnerId() != $this->getPartnerId() && $dbEntry->getDisplayInSearch() == mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK) {
         flavorAssetPeer::setDefaultCriteriaFilter(null);
     }
     $flavorAssetsDb = flavorAssetPeer::retrieveReadyWebByEntryId($entryId);
     if (count($flavorAssetsDb) == 0) {
         throw new KalturaAPIException(KalturaErrors::NO_FLAVORS_FOUND);
     }
     // re-set default criteria to avoid fetching "private" flavors in laetr queries.
     // this should be also set in baseService, but we better do it anyway.
     flavorAssetPeer::setDefaultCriteriaFilter();
     $flavorAssets = KalturaFlavorAssetArray::fromDbArray($flavorAssetsDb);
     return $flavorAssets;
 }