public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new kAssetParamsResourceContainer();
     }
     if ($this->resource) {
         $object_to_fill->setResource($this->resource->toObject());
     }
     $object_to_fill->setAssetParamsId($this->assetParamsId);
     return $object_to_fill;
 }
 /**
  * @param kAssetParamsResourceContainer $resource
  * @param entry $dbEntry
  * @param asset $dbAsset
  * @return asset
  * @throws KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND
  */
 protected function attachAssetParamsResourceContainer(kAssetParamsResourceContainer $resource, entry $dbEntry, asset $dbAsset = null)
 {
     $assetParams = assetParamsPeer::retrieveByPK($resource->getAssetParamsId());
     if (!$assetParams) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_ID_NOT_FOUND, $resource->getAssetParamsId());
     }
     if (!$dbAsset) {
         $dbAsset = assetPeer::retrieveByEntryIdAndParams($dbEntry->getId(), $resource->getAssetParamsId());
     }
     $isNewAsset = false;
     if (!$dbAsset) {
         $isNewAsset = true;
         $dbAsset = assetPeer::getNewAsset($assetParams->getType());
         $dbAsset->setPartnerId($dbEntry->getPartnerId());
         $dbAsset->setEntryId($dbEntry->getId());
         $dbAsset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
         $dbAsset->setFlavorParamsId($resource->getAssetParamsId());
         $dbAsset->setFromAssetParams($assetParams);
         if ($assetParams->hasTag(assetParams::TAG_SOURCE)) {
             $dbAsset->setIsOriginal(true);
         }
     }
     $dbAsset->incrementVersion();
     $dbAsset->save();
     $dbAsset = $this->attachResource($resource->getResource(), $dbEntry, $dbAsset);
     if ($dbAsset && $isNewAsset && $dbAsset->getStatus() != asset::FLAVOR_ASSET_STATUS_IMPORTING) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
     }
     return $dbAsset;
 }