本文整理汇总了PHP中Version::setUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Version::setUserId方法的具体用法?PHP Version::setUserId怎么用?PHP Version::setUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Version
的用法示例。
在下文中一共展示了Version::setUserId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* @return void
*/
protected function update()
{
if (!$this->getFilename() && $this->getId() != 1) {
$this->delete();
throw new Exception("Asset requires filename, asset with id " . $this->getId() . " deleted");
}
// set date
$this->setModificationDate(time());
// save data
$conf = Pimcore_Config::getSystemConfig();
// create foldertree
$destinationPath = $this->getFileSystemPath();
if (!is_dir(dirname($destinationPath))) {
mkdir(dirname($destinationPath), self::$chmod, true);
}
if ($this->_oldPath) {
rename(PIMCORE_ASSET_DIRECTORY . $this->_oldPath, $this->getFileSystemPath());
}
if ($this->getType() != "folder") {
// get data
$this->getData();
// remove if exists
if (is_file($destinationPath)) {
unlink($destinationPath);
}
file_put_contents($destinationPath, $this->getData());
chmod($destinationPath, self::$chmod);
// check file exists
if (!is_file($destinationPath)) {
throw new Exception("couldn't create new asset");
}
// set mime type
$mimetype = MIME_Type::autoDetect($this->getFileSystemPath());
$this->setMimetype($mimetype);
// set type
$this->setTypeFromMapping();
// update scheduled tasks
$this->saveScheduledTasks();
// create version
$this->getData();
// load data from filesystem to put it into the version
$version = new Version();
$version->setCid($this->getId());
$version->setCtype("asset");
$version->setDate($this->getModificationDate());
$version->setUserId($this->getUserModification());
$version->setData($this);
$version->save();
}
// save properties
$this->getProperties();
$this->getResource()->deleteAllProperties();
if (is_array($this->getProperties()) and count($this->getProperties()) > 0) {
foreach ($this->getProperties() as $property) {
if (!$property->getInherited()) {
$property->setResource(null);
$property->setCid($this->getId());
$property->setCpath($this->getPath() . $this->getKey());
$property->save();
}
}
}
// save permissions
$this->getPermissions();
if (is_array($this->permissions)) {
// remove all permissions
$this->getResource()->deleteAllPermissions();
foreach ($this->permissions as $permission) {
$permission->setId(null);
$permission->setCid($this->getId());
$permission->setCpath($this->getFullPath());
$permission->save();
}
}
// save dependencies
$d = $this->getDependencies();
$d->clean();
foreach ($this->resolveDependencies() as $requirement) {
if ($requirement["id"] == $this->getId() && $requirement["type"] == "asset") {
// dont't add a reference to yourself
continue;
} else {
$d->addRequirement($requirement["id"], $requirement["type"]);
}
}
$d->save();
$this->getResource()->update();
if ($this->_oldPath) {
$this->getResource()->updateChildsPaths($this->_oldPath);
}
$this->clearDependedCache();
//set object to registry
Zend_Registry::set("asset_" . $this->getId(), $this);
Pimcore_API_Plugin_Broker::getInstance()->postUpdateAsset($this);
}
示例2: saveVersion
/**
* Save the current object as version
*
* @return void
*/
public function saveVersion($setModificationDate = true, $callPluginHook = true)
{
// hook should be also called if "save only new version" is selected
if ($callPluginHook) {
Pimcore_API_Plugin_Broker::getInstance()->preUpdateDocument($this);
}
// set date
if ($setModificationDate) {
$this->setModificationDate(time());
}
// scheduled tasks are saved always, they are not versioned!
$this->saveScheduledTasks();
// create version
$version = new Version();
$version->setCid($this->getId());
$version->setCtype("document");
$version->setDate($this->getModificationDate());
$version->setUserId($this->getUserModification());
$version->setData($this);
$version->save();
// hook should be also called if "save only new version" is selected
if ($callPluginHook) {
Pimcore_API_Plugin_Broker::getInstance()->postUpdateDocument($this);
}
}
示例3: saveVersion
/**
* $directCall is true when the method is called from outside (eg. directly in the controller "save only version")
* it is false when the method is called by $this->update()
* @param bool $setModificationDate
* @param bool $directCall
* @return Version
*/
public function saveVersion($setModificationDate = true, $directCall = true)
{
if ($setModificationDate) {
$this->setO_modificationDate(time());
}
// hook should be also called if "save only new version" is selected
if ($directCall) {
Pimcore_API_Plugin_Broker::getInstance()->preUpdateObject($this);
}
// scheduled tasks are saved always, they are not versioned!
if ($directCall) {
$this->saveScheduledTasks();
}
$version = null;
// only create a new version if there is at least 1 allowed
if (Pimcore_Config::getSystemConfig()->objects->versions) {
// create version
$version = new Version();
$version->setCid($this->getO_Id());
$version->setCtype("object");
$version->setDate($this->getO_modificationDate());
$version->setUserId($this->getO_userModification());
$version->setData($this);
$version->save();
}
// hook should be also called if "save only new version" is selected
if ($directCall) {
Pimcore_API_Plugin_Broker::getInstance()->postUpdateObject($this);
}
return $version;
}
示例4: saveVersion
/**
* Save the current object as version
*
* @return void
*/
public function saveVersion($setModificationDate = true)
{
// set date
if ($setModificationDate) {
$this->setModificationDate(time());
}
// scheduled tasks are saved always, they are not versioned!
$this->saveScheduledTasks();
// create version
$version = new Version();
$version->setCid($this->getId());
$version->setCtype("document");
$version->setDate($this->getModificationDate());
$version->setUserId($this->getUserModification());
$version->setData($this);
$version->save();
}