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


PHP Document::getType方法代码示例

本文整理汇总了PHP中Pimcore\Model\Document::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::getType方法的具体用法?PHP Document::getType怎么用?PHP Document::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Model\Document的用法示例。


在下文中一共展示了Document::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()}]");
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:12,代码来源:Manager.php

示例2: upperCastDocument

 /**
  * @static
  * @param Document $doc
  * @return Document
  */
 public static function upperCastDocument(Document $doc)
 {
     $to_class = "Pimcore\\Model\\Document\\Hardlink\\Wrapper\\" . ucfirst($doc->getType());
     $old_serialized_prefix = "O:" . strlen(get_class($doc));
     $old_serialized_prefix .= ":\"" . get_class($doc) . "\":";
     // unset eventually existing children, because of performance reasons when serializing the document
     $doc->setChilds(null);
     $old_serialized_object = Serialize::serialize($doc);
     $new_serialized_object = 'O:' . strlen($to_class) . ':"' . $to_class . '":';
     $new_serialized_object .= substr($old_serialized_object, strlen($old_serialized_prefix));
     $document = Serialize::unserialize($new_serialized_object);
     return $document;
 }
开发者ID:rolandstoll,项目名称:pimcore,代码行数:18,代码来源:Service.php

示例3: 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

示例4: getById

 /**
  * Static helper to get a Document by it's id, only type Document is returned, not Document\Page, ... (see getConcreteById() )
  *
  * @param integer $id
  * @return Document
  */
 public static function getById($id)
 {
     $id = intval($id);
     if ($id < 1) {
         return null;
     }
     $cacheKey = "document_" . $id;
     try {
         $document = \Zend_Registry::get($cacheKey);
         if (!$document) {
             throw new \Exception("Document in registry is null");
         }
     } catch (\Exception $e) {
         try {
             if (!($document = Cache::load($cacheKey))) {
                 $document = new Document();
                 $document->getResource()->getById($id);
                 $mappingClass = "\\Pimcore\\Model\\Document\\" . ucfirst($document->getType());
                 // this is the fallback for custom document types using prefixes
                 // so we need to check if the class exists first
                 if (!\Pimcore\Tool::classExists($mappingClass)) {
                     $oldStyleClass = "Document_" . ucfirst($document->getType());
                     if (\Pimcore\Tool::classExists($oldStyleClass)) {
                         $mappingClass = $oldStyleClass;
                     }
                 }
                 $typeClass = Tool::getModelClassMapping($mappingClass);
                 if (Tool::classExists($typeClass)) {
                     $document = new $typeClass();
                     \Zend_Registry::set($cacheKey, $document);
                     $document->getResource()->getById($id);
                     Cache::save($document, $cacheKey);
                 }
             } else {
                 \Zend_Registry::set($cacheKey, $document);
             }
         } catch (\Exception $e) {
             \Logger::warning($e->getMessage());
             return null;
         }
     }
     if (!$document) {
         return null;
     }
     return $document;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:52,代码来源:Document.php


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