/** * Return a list of related videos for a specific video entry * * @action listRelatedMedieEntries * @param string $entryId * @param KalturaRelatedScope $scope * @param KalturaFilterPager $pager * @return KalturaMediaListResponse */ public function listRelatedMedieEntriesAction($entryId, KalturaRelatedScope $scope = null, KalturaFilterPager $pager = null) { $mediaService = new MediaService(); $mediaService->initService('media', 'media', 'get'); $entry = $mediaService->getAction($entryId); if (!$scope) { $scope = new KalturaRelatedScope(); } if (!$pager) { $pager = new KalturaFilterPager(); } $originalKs = kCurrentContext::$ks; $adminKs = $this->getAdminSessionForPartner($entry->partnerId); $mediaEntryFilter = new KalturaMediaEntryFilter(); $mediaEntryFilter->tagsMultiLikeOr = $entry->tags; $mediaEntryFilter->orderBy = KalturaMediaEntryOrderBy::CREATED_AT_DESC; $mediaEntryFilter->advancedSearch = $this->getAdvancedSearch($entry, $scope); kCurrentContext::initKsPartnerUser($adminKs); $mediaService->initService('media', 'media', 'list'); $response = $mediaService->listAction($mediaEntryFilter, $pager); kCurrentContext::initKsPartnerUser($originalKs); return $response; }
/** * Update the content resource associated with the entry. * * @action updateContent * @param string $entryId Entry id to update * @param KalturaResource $resource Resource to be used to replace entry content * @param int $conversionProfileId The conversion profile id to be used on the entry * @return KalturaBaseEntry The updated entry * * @throws KalturaErrors::ENTRY_ID_NOT_FOUND * @validateUser entry entryId edit */ function updateContentAction($entryId, KalturaResource $resource, $conversionProfileId = null) { $dbEntry = entryPeer::retrieveByPK($entryId); if (!$dbEntry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } $baseEntry = new KalturaBaseEntry(); $baseEntry->fromObject($dbEntry); switch ($dbEntry->getType()) { case entryType::MEDIA_CLIP: $service = new MediaService(); $service->initService('media', 'media', $this->actionName); $service->replaceResource($resource, $dbEntry, $conversionProfileId); $baseEntry->fromObject($dbEntry); return $baseEntry; case entryType::MIX: case entryType::PLAYLIST: case entryType::DATA: case entryType::LIVE_STREAM: default: // TODO load from plugin manager other entry services such as document throw new KalturaAPIException(KalturaErrors::ENTRY_TYPE_NOT_SUPPORTED, $baseEntry->type); } return $baseEntry; }