public function entryHandled(entry $dbEntry) { parent::entryHandled($dbEntry); if ($this->resource) { $this->resource->entryHandled($dbEntry); } }
public function entryHandled(entry $dbEntry) { parent::entryHandled($dbEntry); foreach ($this->resources as $resource) { $resource->entryHandled($dbEntry); } }
/** * Add content to media entry which is not yet associated with content (therefore is in status NO_CONTENT). * If the requirement is to replace the entry's associated content, use action updateContent. * * @action addContent * @param string $entryId * @param KalturaResource $resource * @return KalturaMediaEntry * @throws KalturaErrors::ENTRY_ID_NOT_FOUND * @throws KalturaErrors::ENTRY_ALREADY_WITH_CONTENT * @validateUser entry entryId edit */ function addContentAction($entryId, KalturaResource $resource = null) { $dbEntry = entryPeer::retrieveByPK($entryId); if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::MEDIA_CLIP) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } if ($dbEntry->getStatus() != entryStatus::NO_CONTENT) { throw new KalturaAPIException(KalturaErrors::ENTRY_ALREADY_WITH_CONTENT); } if ($resource) { $resource->validateEntry($dbEntry); $kResource = $resource->toObject(); $this->attachResource($kResource, $dbEntry); $resource->entryHandled($dbEntry); } return $this->getEntry($entryId); }
/** * Attach content resource to entry in status NO_MEDIA * * @action addContent * @param string $entryId * @param KalturaResource $resource * @return KalturaBaseEntry * @throws KalturaErrors::ENTRY_TYPE_NOT_SUPPORTED * @validateUser entry entryId edit */ function addContentAction($entryId, KalturaResource $resource) { $dbEntry = entryPeer::retrieveByPK($entryId); if (!$dbEntry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } $kResource = $resource->toObject(); if ($dbEntry->getType() == KalturaEntryType::AUTOMATIC || is_null($dbEntry->getType())) { $this->setEntryTypeByResource($dbEntry, $kResource); } $dbEntry->save(); $resource->validateEntry($dbEntry); $this->attachResource($kResource, $dbEntry); $resource->entryHandled($dbEntry); return $this->getEntry($entryId); }
/** * @param KalturaResource $resource * @param entry $dbEntry * @param int $conversionProfileId */ protected function replaceResource(KalturaResource $resource, entry $dbEntry, $conversionProfileId = null) { if (!$this->getPartner()->getWamsAccountName() || !$this->getPartner()->getWamsAccountKey()) { exit; } if ($dbEntry->getStatus() == KalturaEntryStatus::NO_CONTENT || $dbEntry->getMediaType() == KalturaMediaType::IMAGE) { $resource->validateEntry($dbEntry); if ($conversionProfileId) { $dbEntry->setConversionQuality($conversionProfileId); $dbEntry->save(); } $kResource = $resource->toObject(); $this->attachResource($kResource, $dbEntry); } else { $partner = $this->getPartner(); if (!$partner->getEnabledService(PermissionName::FEATURE_ENTRY_REPLACEMENT)) { KalturaLog::notice("Replacement is not allowed to the partner permission [FEATURE_ENTRY_REPLACEMENT] is needed"); throw new KalturaAPIException(KalturaErrors::FEATURE_FORBIDDEN, PermissionName::FEATURE_ENTRY_REPLACEMENT); } if ($dbEntry->getReplacingEntryId()) { throw new KalturaAPIException(KalturaErrors::ENTRY_REPLACEMENT_ALREADY_EXISTS); } $resource->validateEntry($dbEntry); $tempMediaEntry = new KalturaMediaEntry(); $tempMediaEntry->type = $dbEntry->getType(); $tempMediaEntry->mediaType = $dbEntry->getMediaType(); $tempMediaEntry->conversionProfileId = $dbEntry->getConversionQuality(); if ($conversionProfileId) { $tempMediaEntry->conversionProfileId = $conversionProfileId; } $tempDbEntry = $this->prepareEntryForInsert($tempMediaEntry); $tempDbEntry->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM); $tempDbEntry->setPartnerId($dbEntry->getPartnerId()); $tempDbEntry->setReplacedEntryId($dbEntry->getId()); $tempDbEntry->save(); $dbEntry->setReplacingEntryId($tempDbEntry->getId()); $dbEntry->setReplacementStatus(entryReplacementStatus::NOT_READY_AND_NOT_APPROVED); if (!$partner->getEnabledService(PermissionName::FEATURE_ENTRY_REPLACEMENT_APPROVAL)) { $dbEntry->setReplacementStatus(entryReplacementStatus::APPROVED_BUT_NOT_READY); } $dbEntry->save(); $kResource = $resource->toObject(); $this->attachResource($kResource, $tempDbEntry); } $resource->entryHandled($dbEntry); }