当前位置: 首页>>代码示例>>PHP>>正文


PHP Asset::getId方法代码示例

本文整理汇总了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;
 }
开发者ID:solverat,项目名称:pimcore,代码行数:39,代码来源:Service.php

示例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();
     }
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:20,代码来源:File.php

示例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();
     }
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:13,代码来源:Folder.php

示例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();
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:13,代码来源:Folder.php

示例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;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:28,代码来源:Manager.php

示例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;
 }
开发者ID:sfie,项目名称:pimcore,代码行数:14,代码来源:Href.php

示例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;
 }
开发者ID:ptaferner,项目名称:pimcore,代码行数:13,代码来源:Image.php

示例8: setParent

 /**
  * @param Asset $parent
  * @return void
  */
 public function setParent($parent)
 {
     $this->parent = $parent;
     if ($parent instanceof Asset) {
         $this->parentId = $parent->getId();
     }
     return $this;
 }
开发者ID:Gerhard13,项目名称:pimcore,代码行数:12,代码来源:Asset.php

示例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;
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:13,代码来源:ObjectSelect.php

示例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());
     }
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:10,代码来源:Service.php


注:本文中的Pimcore\Model\Asset::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。