本文整理汇总了PHP中Pimcore\Model\Asset::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::getId方法的具体用法?PHP Asset::getId怎么用?PHP Asset::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Asset
的用法示例。
在下文中一共展示了Asset::getId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyRecursive
/**
* @param Model\Asset $target
* @param Model\Asset $source
* @return Model\Asset copied asset
*/
public function copyRecursive($target, $source)
{
// avoid recursion
if (!$this->_copyRecursiveIds) {
$this->_copyRecursiveIds = [];
}
if (in_array($source->getId(), $this->_copyRecursiveIds)) {
return;
}
$source->getProperties();
$new = clone $source;
$new->id = null;
if ($new instanceof Asset\Folder) {
$new->setChilds(null);
}
$new->setFilename(Element\Service::getSaveCopyName("asset", $new->getFilename(), $target));
$new->setParentId($target->getId());
$new->setUserOwner($this->_user->getId());
$new->setUserModification($this->_user->getId());
$new->setDao(null);
$new->setLocked(false);
$new->setCreationDate(time());
$new->setStream($source->getStream());
$new->save();
// add to store
$this->_copyRecursiveIds[] = $new->getId();
foreach ($source->getChilds() as $child) {
$this->copyRecursive($new, $child);
}
if ($target instanceof Asset\Folder) {
$this->updateChilds($target, $new);
}
return $new;
}
示例2: delete
/**
* @throws DAV\Exception\Forbidden
* @throws \Exception
*/
function delete()
{
if ($this->asset->isAllowed("delete")) {
Asset\Service::loadAllFields($this->asset);
$this->asset->delete();
// add the asset to the delete history, this is used so come over problems with programs like photoshop (delete, create instead of replace => move)
// for details see Asset\WebDAV\Tree::move()
$log = Asset\WebDAV\Service::getDeleteLog();
$this->asset->_fulldump = true;
$log[$this->asset->getFullpath()] = array("id" => $this->asset->getId(), "timestamp" => time(), "data" => \Pimcore\Tool\Serialize::serialize($this->asset));
unset($this->asset->_fulldump);
Asset\WebDAV\Service::saveDeleteLog($log);
} else {
throw new DAV\Exception\Forbidden();
}
}
示例3: createDirectory
/**
* @param string $name
* @throws DAV\Exception\Forbidden
*/
function createDirectory($name)
{
$user = AdminTool::getCurrentUser();
if ($this->asset->isAllowed("create")) {
$asset = Asset::create($this->asset->getId(), array("filename" => File::getValidFilename($name), "type" => "folder", "userModification" => $user->getId(), "userOwner" => $user->getId()));
} else {
throw new DAV\Exception\Forbidden();
}
}
示例4: createDirectory
/**
* @param string $name
* @throws DAV\Exception\Forbidden
*/
public function createDirectory($name)
{
$user = AdminTool::getCurrentUser();
if ($this->asset->isAllowed("create")) {
$asset = Asset::create($this->asset->getId(), ["filename" => Element\Service::getValidKey($name, "asset"), "type" => "folder", "userModification" => $user->getId(), "userOwner" => $user->getId()]);
} else {
throw new DAV\Exception\Forbidden();
}
}
示例5: getAvailableStatuses
/**
* Returns the available statuses given an action and a state
*
* @param $actionName
* @param $stateName
* @return array
* @throws \Exception
*/
public function getAvailableStatuses($actionName, $stateName)
{
$actionConfig = $this->workflow->getActionConfig($actionName);
$globalAction = $this->workflow->isGlobalAction($actionName);
$hasTransition = $this->actionHasTransition($actionConfig);
if ($globalAction || !$hasTransition) {
$objectStatus = $this->getElementStatus();
$availableStatuses = [$objectStatus => $this->workflow->getStatusConfig($objectStatus)];
} else {
//we have a check here for the state being an existing one
if (!isset($actionConfig['transitionTo'][$stateName])) {
throw new \Exception("Workflow::getAvailableStatuses, State [{$stateName}] not valid for action [{$actionName}] on element [{$this->element->getId()}] with status [{$this->getElementStatus()}]");
}
$availableStatuses = [];
foreach ($actionConfig['transitionTo'][$stateName] as $statusName) {
$availableStatuses[$statusName] = $this->workflow->getStatusConfig($statusName);
}
}
return $availableStatuses;
}
示例6: getDataForEditmode
/**
* @see Object\ClassDefinition\Data::getDataForEditmode
* @param Asset|Document|Object\AbstractObject $data
* @param null|Model\Object\AbstractObject $object
* @return array
*/
public function getDataForEditmode($data, $object = null)
{
if ($data instanceof Element\ElementInterface) {
$r = array("id" => $data->getId(), "path" => $data->getFullPath(), "subtype" => $data->getType(), "type" => Element\Service::getElementType($data));
return $r;
}
return;
}
示例7: getDataForQueryResource
/**
* @see Object\ClassDefinition\Data::getDataForQueryResource
* @param Asset $data
* @param null|Model\Object\AbstractObject $object
* @return integer|null
*/
public function getDataForQueryResource($data, $object = null)
{
if ($data instanceof Asset) {
return $data->getId();
}
return null;
}
示例8: setParent
/**
* @param Asset $parent
* @return void
*/
public function setParent($parent)
{
$this->parent = $parent;
if ($parent instanceof Asset) {
$this->parentId = $parent->getId();
}
return $this;
}
示例9: getDataForResource
/**
* @see Object\ClassDefinition\Data::getDataForResource
* @param Asset $data
* @param null|Model\Object\AbstractObject $object
* @return integer|null
*/
public function getDataForResource($data, $object = null)
{
if ($data instanceof Object\CoreShopOrderState) {
return $data->getId();
}
return null;
}
示例10: getDependencyForFrontend
/**
* @param Document|Asset|Object\AbstractObject $element
* @return array
*/
public static function getDependencyForFrontend($element)
{
if ($element instanceof ElementInterface) {
return array("id" => $element->getId(), "path" => $element->getFullPath(), "type" => self::getElementType($element), "subtype" => $element->getType());
}
}