Exemplo n.º 1
0
 public static function fromDbArray($arr)
 {
     $newArr = new KalturaMediaInfoArray();
     if ($arr == null) {
         return $newArr;
     }
     foreach ($arr as $obj) {
         $nObj = new KalturaMediaInfo();
         $nObj->fromObject($obj);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
Exemplo n.º 2
0
 public static function fromDbArray($arr, KalturaDetachedResponseProfile $responseProfile = null)
 {
     $newArr = new KalturaMediaInfoArray();
     if ($arr == null) {
         return $newArr;
     }
     foreach ($arr as $obj) {
         $nObj = new KalturaMediaInfo();
         $nObj->fromObject($obj, $responseProfile);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
 /**
  * batch addMediaInfoAction action saves a media info object
  * 
  * @action addMediaInfo
  * @param KalturaMediaInfo $mediaInfo
  * @return KalturaMediaInfo 
  * @throws KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND
  */
 function addMediaInfoAction(KalturaMediaInfo $mediaInfo)
 {
     $mediaInfoDb = null;
     $flavorAsset = null;
     if ($mediaInfo->flavorAssetId) {
         $flavorAsset = assetPeer::retrieveByIdNoFilter($mediaInfo->flavorAssetId);
         if (!$flavorAsset) {
             throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $mediaInfo->flavorAssetId);
         }
         $mediaInfoDb = mediaInfoPeer::retrieveByFlavorAssetId($mediaInfo->flavorAssetId);
         if ($mediaInfoDb && $mediaInfoDb->getFlavorAssetVersion() == $flavorAsset->getVersion()) {
             $mediaInfoDb = $mediaInfo->toUpdatableObject($mediaInfoDb);
         } else {
             $mediaInfoDb = null;
         }
     }
     if (!$mediaInfoDb) {
         $mediaInfoDb = $mediaInfo->toInsertableObject();
     }
     if ($flavorAsset) {
         $mediaInfoDb->setFlavorAssetVersion($flavorAsset->getVersion());
     }
     $mediaInfoDb = kBatchManager::addMediaInfo($mediaInfoDb);
     $mediaInfo->fromObject($mediaInfoDb);
     return $mediaInfo;
 }
Exemplo n.º 4
0
 /**
  * batch addMediaInfoAction action saves a media info object
  * 
  * @action addMediaInfo
  * @param KalturaMediaInfo $mediaInfo
  * @return KalturaMediaInfo 
  */
 function addMediaInfoAction(KalturaMediaInfo $mediaInfo)
 {
     $mediaInfoDb = null;
     $flavorAsset = null;
     if ($mediaInfo->flavorAssetId) {
         $flavorAsset = flavorAssetPeer::retrieveById($mediaInfo->flavorAssetId);
         $mediaInfoDb = mediaInfoPeer::retrieveByFlavorAssetId($mediaInfo->flavorAssetId);
         if ($mediaInfoDb && $mediaInfoDb->getFlavorAssetVersion() == $flavorAsset->getVersion()) {
             $mediaInfoDb = $mediaInfo->toUpdatableObject($mediaInfoDb);
         } else {
             $mediaInfoDb = null;
         }
     }
     if (!$mediaInfoDb) {
         $mediaInfoDb = $mediaInfo->toInsertableObject();
     }
     if ($flavorAsset) {
         $mediaInfoDb->setFlavorAssetVersion($flavorAsset->getVersion());
     }
     $mediaInfoDb = kBatchManager::addMediaInfo($mediaInfoDb);
     $mediaInfo->fromObject($mediaInfoDb);
     return $mediaInfo;
 }