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; }
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; }
function addMediaInfo(KalturaMediaInfo $mediaInfo) { $kparams = array(); $this->client->addParam($kparams, "mediaInfo", $mediaInfo->toParams()); $this->client->queueServiceActionCall("metadata_metadatabatch", "addMediaInfo", $kparams); if ($this->client->isMultiRequest()) { return null; } $resultObject = $this->client->doQueue(); $this->client->throwExceptionIfError($resultObject); $this->client->validateObjectType($resultObject, "KalturaMediaInfo"); return $resultObject; }
/** * 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; }
/** * 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; }