public function toInsertableObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new timedThumbAsset();
     }
     return parent::toInsertableObject($object_to_fill, $props_to_skip);
 }
Exemple #2
0
 /**
  * Add thumbnail asset
  *
  * @action add
  * @param string $entryId
  * @param KalturaThumbAsset $thumbAsset
  * @return KalturaThumbAsset
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  * @throws KalturaErrors::THUMB_ASSET_ALREADY_EXISTS
  * @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::RECORDED_WEBCAM_FILE_NOT_FOUND
  * @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
  * @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
  * @throws KalturaErrors::RESOURCE_TYPE_NOT_SUPPORTED
  * @validateUser entry entryId edit
  */
 function addAction($entryId, KalturaThumbAsset $thumbAsset)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || !in_array($dbEntry->getType(), $this->getEnabledMediaTypes()) || !in_array($dbEntry->getMediaType(), array(KalturaMediaType::VIDEO, KalturaMediaType::AUDIO, KalturaMediaType::LIVE_STREAM_FLASH))) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     if ($thumbAsset->thumbParamsId) {
         $dbThumbAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $thumbAsset->thumbParamsId);
         if ($dbThumbAsset) {
             throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ALREADY_EXISTS, $dbThumbAsset->getId(), $thumbAsset->thumbParamsId);
         }
     }
     $dbThumbAsset = $thumbAsset->toInsertableObject();
     /* @var $dbThumbAsset thumbAsset */
     $dbThumbAsset->setEntryId($entryId);
     $dbThumbAsset->setPartnerId($dbEntry->getPartnerId());
     $dbThumbAsset->setStatus(thumbAsset::ASSET_STATUS_QUEUED);
     $dbThumbAsset->save();
     $thumbAsset = KalturaThumbAsset::getInstance($dbThumbAsset, $this->getResponseProfile());
     return $thumbAsset;
 }