/** * Update details and settings of an existing partner * * @action update * @param KalturaPartner $partner * @param bool $allowEmpty * @return KalturaPartner * * @throws APIErrors::UNKNOWN_PARTNER_ID */ public function updateAction(KalturaPartner $partner, $allowEmpty = false) { kWAMS::testConnection($partner->wamsAccountName, $partner->wamsAccountKey); $dbPartner = PartnerPeer::retrieveByPK($this->getPartnerId()); if (!$dbPartner) { throw new KalturaAPIException(APIErrors::UNKNOWN_PARTNER_ID, $this->getPartnerId()); } try { $dbPartner = $partner->toUpdatableObject($dbPartner); $dbPartner->save(); } catch (kUserException $e) { if ($e->getCode() === kUserException::USER_NOT_FOUND) { throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND); } throw $e; } catch (kPermissionException $e) { if ($e->getCode() === kPermissionException::ACCOUNT_OWNER_NEEDS_PARTNER_ADMIN_ROLE) { throw new KalturaAPIException(KalturaErrors::ACCOUNT_OWNER_NEEDS_PARTNER_ADMIN_ROLE); } throw $e; } $partner = new KalturaPartner(); $partner->fromPartner($dbPartner); return $partner; }
/** * Replace content associated with the media entry. * * @action updateContent * @param string $entryId Media entry id to update * @param KalturaResource $resource Resource to be used to replace entry media content * @param int $conversionProfileId The conversion profile id to be used on the entry * @return KalturaMediaEntry The updated media entry * @throws KalturaErrors::ENTRY_ID_NOT_FOUND * @throws KalturaErrors::ENTRY_REPLACEMENT_ALREADY_EXISTS * @throws KalturaErrors::INVALID_OBJECT_ID * @validateUser entry entryId edit */ function updateContentAction($entryId, KalturaResource $resource, $conversionProfileId = null) { $dbEntry = entryPeer::retrieveByPK($entryId); if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::MEDIA_CLIP) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } kWAMS::testConnection($this->getPartner()->getWamsAccountName(), $this->getPartner()->getWamsAccountKey()); $this->replaceResource($resource, $dbEntry, $conversionProfileId); return $this->getEntry($entryId); }