本文整理汇总了PHP中Pimcore\Model\Asset::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::getType方法的具体用法?PHP Asset::getType怎么用?PHP Asset::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Asset
的用法示例。
在下文中一共展示了Asset::getType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initWorkflow
/**
* Loads the workflow into the manager
* @throws \Exception
*/
private function initWorkflow()
{
$config = Workflow\Config::getElementWorkflowConfig($this->element);
$this->workflow = Workflow\Factory::getWorkflowFromConfig($config);
if (!$this->workflow) {
throw new \Exception("Cannot load workflow configuration for object [{$this->element->getId()}] of type [{$this->element->getType()}]");
}
}
示例2: 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;
}
示例3: getById
/**
* Static helper to get an asset by the passed id (returned is not the concrete asset like Asset\Folder!)
*
* @param integer $id
* @return Asset
*/
public static function getById($id)
{
$id = intval($id);
if ($id < 1) {
return null;
}
$cacheKey = "asset_" . $id;
try {
$asset = \Zend_Registry::get($cacheKey);
if (!$asset) {
throw new \Exception("Asset in registry is null");
}
} catch (\Exception $e) {
try {
if (!($asset = Cache::load($cacheKey))) {
$asset = new Asset();
$asset->getResource()->getById($id);
$mappingClass = "\\Pimcore\\Model\\Asset\\" . ucfirst($asset->getType());
$typeClass = Tool::getModelClassMapping($mappingClass);
if (Tool::classExists($typeClass)) {
$asset = new $typeClass();
\Zend_Registry::set($cacheKey, $asset);
$asset->getResource()->getById($id);
Cache::save($asset, $cacheKey);
}
} else {
\Zend_Registry::set($cacheKey, $asset);
}
} catch (\Exception $e) {
\Logger::warning($e->getMessage());
return null;
}
}
if (!$asset) {
return null;
}
return $asset;
}
示例4: getById
/**
* Static helper to get an asset by the passed id (returned is not the concrete asset like Asset\Folder!)
*
* @param integer $id
* @return Asset
*/
public static function getById($id)
{
$id = intval($id);
if ($id < 1) {
return null;
}
$cacheKey = "asset_" . $id;
try {
$asset = \Zend_Registry::get($cacheKey);
if (!$asset) {
throw new \Exception("Asset in registry is null");
}
} catch (\Exception $e) {
try {
if (!($asset = \Pimcore\Cache::load($cacheKey))) {
$asset = new Asset();
$asset->getDao()->getById($id);
$className = "Pimcore\\Model\\Asset\\" . ucfirst($asset->getType());
$asset = \Pimcore::getDiContainer()->make($className);
\Zend_Registry::set($cacheKey, $asset);
$asset->getDao()->getById($id);
\Pimcore\Cache::save($asset, $cacheKey);
} else {
\Zend_Registry::set($cacheKey, $asset);
}
} catch (\Exception $e) {
\Logger::warning($e->getMessage());
return null;
}
}
if (!$asset) {
return null;
}
return $asset;
}