本文整理汇总了PHP中asset::save方法的典型用法代码示例。如果您正苦于以下问题:PHP asset::save方法的具体用法?PHP asset::save怎么用?PHP asset::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asset
的用法示例。
在下文中一共展示了asset::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addImportJob
public static function addImportJob(BatchJob $parentJob = null, $entryId, $partnerId, $entryUrl, asset $asset = null, $subType = null, kImportJobData $jobData = null, $keepCurrentVersion = false)
{
$entryUrl = str_replace('//', '/', $entryUrl);
$entryUrl = preg_replace('/^((https?)|(ftp)|(scp)|(sftp)):\\//', '$1://', $entryUrl);
if (is_null($subType)) {
if (stripos($entryUrl, 'sftp:') === 0) {
$subType = kFileTransferMgrType::SFTP;
} elseif (stripos($entryUrl, 'scp:') === 0) {
$subType = kFileTransferMgrType::SCP;
} elseif (stripos($entryUrl, 'ftp:') === 0) {
$subType = kFileTransferMgrType::FTP;
} elseif (stripos($entryUrl, 'https:') === 0) {
$subType = kFileTransferMgrType::HTTPS;
} else {
$subType = kFileTransferMgrType::HTTP;
}
}
if (!$jobData) {
$jobData = new kImportJobData();
}
$jobData->setSrcFileUrl($entryUrl);
if ($asset) {
if ($keepCurrentVersion) {
if (!$asset->isLocalReadyStatus()) {
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_IMPORTING);
}
} else {
$asset->incrementVersion();
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_IMPORTING);
}
$asset->save();
$jobData->setFlavorAssetId($asset->getId());
}
$entry = entryPeer::retrieveByPK($entryId);
if ($entry) {
$higherStatuses = array(entryStatus::PRECONVERT, entryStatus::READY);
if (!in_array($entry->getStatus(), $higherStatuses)) {
$entry->setStatus(entryStatus::IMPORT);
$entry->save();
}
}
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild(BatchJobType::IMPORT, $subType);
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($entryId);
$batchJob->setPartnerId($partnerId);
}
$batchJob->setObjectId($jobData->getFlavorAssetId());
$batchJob->setObjectType(BatchJobObjectType::ASSET);
return self::addJob($batchJob, $jobData, BatchJobType::IMPORT, $subType);
}
示例2: save
public function save(PropelPDO $con = null)
{
// check if flavor asset is new before saving
$isNew = $this->isNew();
$statusModified = $this->isColumnModified(assetPeer::STATUS);
$flavorParamsIdModified = $this->isColumnModified(assetPeer::FLAVOR_PARAMS_ID);
// save the asset
$saveResult = parent::save();
// update associated entry's flavorParamsId list
if ($this->getStatus() == self::ASSET_STATUS_READY && ($isNew || $statusModified || $flavorParamsIdModified)) {
$entry = $this->getentry();
if (!$entry) {
KalturaLog::err('Cannot get entry object for flavor asset id [' . $this->getId() . ']');
} else {
KalturaLog::debug('Adding flavor params id [' . $this->getFlavorParamsId() . '] to entry id [' . $entry->getId() . ']');
$entry->addFlavorParamsId($this->getFlavorParamsId());
if ($flavorParamsIdModified) {
$entry->removeFlavorParamsId($this->getColumnsOldValue(assetPeer::FLAVOR_PARAMS_ID));
}
$entry->save();
}
}
// return the parent::save result
return $saveResult;
}
示例3: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aasset !== null) {
if ($this->aasset->isModified() || $this->aasset->isNew()) {
$affectedRows += $this->aasset->save($con);
}
$this->setasset($this->aasset);
}
if ($this->isNew()) {
$this->modifiedColumns[] = mediaInfoPeer::ID;
}
// If this object has been modified, then save it to the database.
$this->objectSaved = false;
if ($this->isModified()) {
if ($this->isNew()) {
$pk = mediaInfoPeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
$this->objectSaved = true;
} else {
$affectedObjects = mediaInfoPeer::doUpdate($this, $con);
if ($affectedObjects) {
$this->objectSaved = true;
}
$affectedRows += $affectedObjects;
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例4: conditionalAssetLocalFileSyncsDelete
private static function conditionalAssetLocalFileSyncsDelete(FileSync $fileSync, asset $asset)
{
$unClosedStatuses = array(asset::ASSET_STATUS_QUEUED, asset::ASSET_STATUS_CONVERTING, asset::ASSET_STATUS_WAIT_FOR_CONVERT, asset::ASSET_STATUS_EXPORTING);
$unClosedAssets = assetPeer::retrieveReadyByEntryId($asset->getEntryId(), null, $unClosedStatuses);
if (count($unClosedAssets)) {
$asset->setFileSyncVersionsToDelete(array($fileSync->getVersion()));
$asset->save();
return;
}
$assetsToDelete = assetPeer::retrieveReadyByEntryId($asset->getEntryId());
self::deleteAssetLocalFileSyncsByAssetArray($assetsToDelete);
self::deleteAssetLocalFileSyncs($fileSync->getVersion(), $asset);
}