getType() 공개 메소드

public getType ( ) : string
리턴 string
예제 #1
0
파일: Manager.php 프로젝트: pimcore/pimcore
 /**
  * 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
0
파일: Href.php 프로젝트: sfie/pimcore
 /**
  * @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
0
파일: Asset.php 프로젝트: Gerhard13/pimcore
 /**
  * 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
0
파일: Asset.php 프로젝트: solverat/pimcore
 /**
  * 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;
 }