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


PHP Object\ClassDefinition类代码示例

本文整理汇总了PHP中Pimcore\Model\Object\ClassDefinition的典型用法代码示例。如果您正苦于以下问题:PHP ClassDefinition类的具体用法?PHP ClassDefinition怎么用?PHP ClassDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ClassDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTableName

 /**
  * @param Object\ClassDefinition $class
  * @param bool $query
  * @return string
  */
 public function getTableName(Object\ClassDefinition $class, $query = false)
 {
     if ($query) {
         return "object_brick_query_" . $this->model->getKey() . "_" . $class->getId();
     } else {
         return "object_brick_store_" . $this->model->getKey() . "_" . $class->getId();
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:13,代码来源:Dao.php

示例2: removeClass

 /**
  * @param string $name
  */
 public function removeClass($name)
 {
     $class = ClassDefinition::getByName($name);
     if ($class) {
         $class->delete();
     }
 }
开发者ID:Pegasuz,项目名称:member,代码行数:10,代码来源:Installer.php

示例3: isInstalled

 public static function isInstalled()
 {
     $memberClass = ClassDefinition::getByName('Member');
     if ($memberClass) {
         return true;
     }
     return false;
 }
开发者ID:Pegasuz,项目名称:member,代码行数:8,代码来源:Plugin.php

示例4: load

 /**
  * Loads a list of object-classes for the specicifies parameters, returns an array of Object|Class elements
  *
  * @return array
  */
 public function load()
 {
     $classes = array();
     $classesRaw = $this->db->fetchCol("SELECT id FROM classes" . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     foreach ($classesRaw as $classRaw) {
         $classes[] = Object\ClassDefinition::getById($classRaw);
     }
     $this->model->setClasses($classes);
     return $classes;
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:15,代码来源:Dao.php

示例5: indexAction

 /**
  * @todo refactor steps into proper methods instead of doing it all in the action
  * @throws Exception
  */
 public function indexAction()
 {
     // reachable via http://your.domain/plugin/Prototyper/admin/index
     $this->view->previewData = null;
     $this->view->csvText = $this->getParam('csv');
     $this->view->classname = $this->getParam('classname');
     $csvData = array();
     $rowNr = 0;
     $rows = str_getcsv($this->view->csvText, "\n");
     //parse the rows
     foreach ($rows as $row) {
         $rowNr++;
         $rowData = str_getcsv($row, ";");
         $csvData[] = $rowData;
         if ($rowNr == 1) {
             $fieldNames = array();
             $fieldTitles = array();
             foreach ($rowData as $cell) {
                 $fieldTitles[] = $cell;
                 $fieldNames[] = $this->getFieldName($cell);
             }
             $csvData[] = $fieldNames;
         }
         if ($rowNr > 10) {
             break;
         }
     }
     $this->view->previewTable = $csvData;
     $fieldList = array();
     foreach ($fieldNames as $fieldName) {
         $fieldTitle = array_shift($fieldTitles);
         ob_start();
         include __DIR__ . "/../classes/field.json.php";
         $fieldList[] = ob_get_clean();
     }
     $fields = implode(',', $fieldList);
     ob_start();
     include __DIR__ . "/../classes/object.json.php";
     $jsonText = ob_get_clean();
     if ($this->getParam('generate') != '') {
         $class = Object\ClassDefinition::getByName($this->correctClassname($this->getParam("classname")));
         if ($class == null) {
             $class = Object\ClassDefinition::create(array('name' => $this->correctClassname($this->getParam("classname")), 'userOwner' => $this->user->getId()));
             $class->save();
         }
         $class = Object\ClassDefinition::getById($class->getId());
         $success = Object\ClassDefinition\Service::importClassDefinitionFromJson($class, $jsonText);
         if ($success) {
             $this->view->successMessage = '<strong>Class generation successful.</strong>';
         }
     }
 }
开发者ID:basilicom,项目名称:pimcore-plugin-prototyper,代码行数:56,代码来源:AdminController.php

示例6: exceptionHandler

 /**
  * @param $e
  * @return array
  * @throws
  * @throws \Exception
  */
 protected function exceptionHandler($e)
 {
     // create view if it doesn't exist already // HACK
     $pdoMySQL = preg_match("/Base table or view not found/", $e->getMessage());
     $Mysqli = preg_match("/Table (.*) doesn't exist/", $e->getMessage());
     if (($Mysqli || $pdoMySQL) && $this->firstException) {
         $this->firstException = false;
         $localizedFields = new Object\Localizedfield();
         $localizedFields->setClass(Object\ClassDefinition::getById($this->model->getClassId()));
         $localizedFields->createUpdateTable();
         return $this->load();
     }
     throw $e;
 }
开发者ID:krugerke,项目名称:pimcore,代码行数:20,代码来源:Resource.php

示例7: __construct

 /**
  * @param null $classId
  * @throws \Exception
  */
 public function __construct($classId = null)
 {
     $class = null;
     if (is_string($classId)) {
         $class = Object\ClassDefinition::getByName($classId);
     } elseif (is_int($classId)) {
         $class = Object\ClassDefinition::getById($classId);
     } elseif ($classId !== null) {
         throw new \Exception("No valid class identifier given (class name or ID)");
     }
     if ($class instanceof Object\ClassDefinition) {
         $this->setClass($class);
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:18,代码来源:Newsletter.php

示例8: isInstalled

 /**
  * @return boolean $isInstalled
  */
 public static function isInstalled()
 {
     $entry = Object\ClassDefinition::getByName('CoreShopProduct');
     $category = Object\ClassDefinition::getByName('CoreShopProduct');
     $cartItem = Object\ClassDefinition::getByName('CoreShopCart');
     $cart = Object\ClassDefinition::getByName('CoreShopCartItem');
     $order = Object\ClassDefinition::getByName('CoreShopOrder');
     $orderItem = Object\ClassDefinition::getByName('CoreShopOrderItem');
     $orderPayment = Object\ClassDefinition::getByName('CoreShopPayment');
     //$cartRule = Object\ClassDefinition::getByName('CoreShopCartRule');
     $orderState = Object\ClassDefinition::getByName('CoreShopOrderState');
     if ($entry && $category && $cart && $cartItem && $order && $orderItem && $orderPayment && $orderState) {
         return true;
     }
     return false;
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:19,代码来源:Plugin.php

示例9: getClasses

 public function getClasses()
 {
     if ($this->getChildAmount()) {
         $path = $this->model->getFullPath();
         if (!$this->model->getId() || $this->model->getId() == 1) {
             $path = "";
         }
         $classIds = $this->db->fetchCol("SELECT o_classId FROM objects WHERE o_path LIKE ? AND o_type = 'object' GROUP BY o_classId", $path . "/%");
         $classes = array();
         foreach ($classIds as $classId) {
             $classes[] = Object\ClassDefinition::getById($classId);
         }
         return $classes;
     } else {
         return array();
     }
 }
开发者ID:Ahmad-Hilali,项目名称:pimcore,代码行数:17,代码来源:Resource.php

示例10: importObjectBrickFromJson

 /**
  * @param $objectBrick
  * @param $json
  * @return bool
  */
 public static function importObjectBrickFromJson($objectBrick, $json, $throwException = false)
 {
     $importData = \Zend_Json::decode($json);
     // reverse map the class name to the class ID, see: self::generateObjectBrickJson()
     if (is_array($importData["classDefinitions"])) {
         foreach ($importData["classDefinitions"] as &$cd) {
             if (!is_numeric($cd["classname"])) {
                 $class = Object\ClassDefinition::getByName($cd["classname"]);
                 if ($class) {
                     $cd["classname"] = $class->getId();
                 }
             }
         }
     }
     $layout = self::generateLayoutTreeFromArray($importData["layoutDefinitions"], $throwException);
     $objectBrick->setLayoutDefinitions($layout);
     $objectBrick->setClassDefinitions($importData["classDefinitions"]);
     $objectBrick->setParentClass($importData["parentClass"]);
     $objectBrick->save();
     return true;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:26,代码来源:Service.php

示例11: findAction

 /**
  * @return void
  */
 public function findAction()
 {
     $user = $this->getUser();
     $query = $this->getParam("query");
     if ($query == "*") {
         $query = "";
     }
     $query = str_replace("%", "*", $query);
     $types = explode(",", $this->getParam("type"));
     $subtypes = explode(",", $this->getParam("subtype"));
     $classnames = explode(",", $this->getParam("class"));
     if ($this->getParam("type") == "object" && is_array($classnames) && empty($classnames[0])) {
         $subtypes = array("object", "variant", "folder");
     }
     $offset = intval($this->getParam("start"));
     $limit = intval($this->getParam("limit"));
     $offset = $offset ? $offset : 0;
     $limit = $limit ? $limit : 50;
     $searcherList = new Data\Listing();
     $conditionParts = array();
     $db = \Pimcore\Db::get();
     //exclude forbidden assets
     if (in_array("asset", $types)) {
         if (!$user->isAllowed("assets")) {
             $forbiddenConditions[] = " `type` != 'asset' ";
         } else {
             $forbiddenAssetPaths = Element\Service::findForbiddenPaths("asset", $user);
             if (count($forbiddenAssetPaths) > 0) {
                 for ($i = 0; $i < count($forbiddenAssetPaths); $i++) {
                     $forbiddenAssetPaths[$i] = " (maintype = 'asset' AND fullpath not like " . $db->quote($forbiddenAssetPaths[$i] . "%") . ")";
                 }
                 $forbiddenConditions[] = implode(" AND ", $forbiddenAssetPaths);
             }
         }
     }
     //exclude forbidden documents
     if (in_array("document", $types)) {
         if (!$user->isAllowed("documents")) {
             $forbiddenConditions[] = " `type` != 'document' ";
         } else {
             $forbiddenDocumentPaths = Element\Service::findForbiddenPaths("document", $user);
             if (count($forbiddenDocumentPaths) > 0) {
                 for ($i = 0; $i < count($forbiddenDocumentPaths); $i++) {
                     $forbiddenDocumentPaths[$i] = " (maintype = 'document' AND fullpath not like " . $db->quote($forbiddenDocumentPaths[$i] . "%") . ")";
                 }
                 $forbiddenConditions[] = implode(" AND ", $forbiddenDocumentPaths);
             }
         }
     }
     //exclude forbidden objects
     if (in_array("object", $types)) {
         if (!$user->isAllowed("objects")) {
             $forbiddenConditions[] = " `type` != 'object' ";
         } else {
             $forbiddenObjectPaths = Element\Service::findForbiddenPaths("object", $user);
             if (count($forbiddenObjectPaths) > 0) {
                 for ($i = 0; $i < count($forbiddenObjectPaths); $i++) {
                     $forbiddenObjectPaths[$i] = " (maintype = 'object' AND fullpath not like " . $db->quote($forbiddenObjectPaths[$i] . "%") . ")";
                 }
                 $forbiddenConditions[] = implode(" AND ", $forbiddenObjectPaths);
             }
         }
     }
     if ($forbiddenConditions) {
         $conditionParts[] = "(" . implode(" AND ", $forbiddenConditions) . ")";
     }
     if (!empty($query)) {
         $queryCondition = "( MATCH (`data`,`properties`) AGAINST (" . $db->quote($query) . " IN BOOLEAN MODE) )";
         // the following should be done with an exact-search now "ID", because the Element-ID is now in the fulltext index
         // if the query is numeric the user might want to search by id
         //if(is_numeric($query)) {
         //$queryCondition = "(" . $queryCondition . " OR id = " . $db->quote($query) ." )";
         //}
         $conditionParts[] = $queryCondition;
     }
     //For objects - handling of bricks
     $fields = array();
     $bricks = array();
     if ($this->getParam("fields")) {
         $fields = $this->getParam("fields");
         foreach ($fields as $f) {
             $parts = explode("~", $f);
             if (substr($f, 0, 1) == "~") {
                 //                    $type = $parts[1];
                 //                    $field = $parts[2];
                 //                    $keyid = $parts[3];
                 // key value, ignore for now
             } else {
                 if (count($parts) > 1) {
                     $bricks[$parts[0]] = $parts[0];
                 }
             }
         }
     }
     // filtering for objects
     if ($this->getParam("filter") && $this->getParam("class")) {
         $class = Object\ClassDefinition::getByName($this->getParam("class"));
//.........这里部分代码省略.........
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:101,代码来源:SearchController.php

示例12: getClass

 /**
  * @return Object\ClassDefinition
  */
 public function getClass()
 {
     $class = Object\ClassDefinition::getById($this->getClassId());
     return $class;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:8,代码来源:Concrete.php

示例13: enrichLayoutDefinition

 /**
  *
  */
 public function enrichLayoutDefinition($object)
 {
     $classId = $this->allowedClassId;
     $class = Object\ClassDefinition::getById($classId);
     if (!$classId) {
         return;
     }
     if (!$this->visibleFields) {
         return;
     }
     $this->visibleFieldDefinitions = array();
     $t = \Zend_Registry::get("Zend_Translate");
     $visibleFields = explode(',', $this->visibleFields);
     foreach ($visibleFields as $field) {
         $fd = $class->getFieldDefinition($field);
         if (!$fd) {
             $fieldFound = false;
             if ($localizedfields = $class->getFieldDefinitions()['localizedfields']) {
                 if ($fd = $localizedfields->getFieldDefinition($field)) {
                     $this->visibleFieldDefinitions[$field]["name"] = $fd->getName();
                     $this->visibleFieldDefinitions[$field]["title"] = $fd->getTitle();
                     $this->visibleFieldDefinitions[$field]["fieldtype"] = $fd->getFieldType();
                     if ($fd instanceof Object\ClassDefinition\Data\Select) {
                         $this->visibleFieldDefinitions[$field]["options"] = $fd->getOptions();
                     }
                     $fieldFound = true;
                 }
             }
             if (!$fieldFound) {
                 $this->visibleFieldDefinitions[$field]["name"] = $field;
                 $this->visibleFieldDefinitions[$field]["title"] = $t->translate($field);
                 $this->visibleFieldDefinitions[$field]["fieldtype"] = "input";
             }
         } else {
             $this->visibleFieldDefinitions[$field]["name"] = $fd->getName();
             $this->visibleFieldDefinitions[$field]["title"] = $fd->getTitle();
             $this->visibleFieldDefinitions[$field]["fieldtype"] = $fd->getFieldType();
             $this->visibleFieldDefinitions[$field]["noteditable"] = true;
             if ($fd instanceof Object\ClassDefinition\Data\Select) {
                 $this->visibleFieldDefinitions[$field]["options"] = $fd->getOptions();
             }
         }
     }
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:47,代码来源:ObjectsMetadata.php

示例14: getTableName

 /**
  * @param Object\ClassDefinition $class
  * @return string
  */
 public function getTableName(Object\ClassDefinition $class)
 {
     return "object_collection_" . $this->model->getKey() . "_" . $class->getId();
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:8,代码来源:Dao.php

示例15: ucfirst

$newsletter = Model\Tool\Newsletter\Config::getByName($argv[1]);
if ($newsletter) {
    $pidFile = $newsletter->getPidFile();
    if (file_exists($pidFile)) {
        \Logger::alert("Cannot send newsletters because there's already one active sending process");
        exit;
    }
    $elementsPerLoop = 10;
    $objectList = "\\Pimcore\\Model\\Object\\" . ucfirst($newsletter->getClass()) . "\\Listing";
    $list = new $objectList();
    $conditions = array("(newsletterActive = 1 AND newsletterConfirmed = 1)");
    if ($newsletter->getObjectFilterSQL()) {
        $conditions[] = $newsletter->getObjectFilterSQL();
    }
    if ($newsletter->getPersonas()) {
        $class = Model\Object\ClassDefinition::getByName($newsletter->getClass());
        if ($class && $class->getFieldDefinition("persona")) {
            $personas = array();
            $p = explode(",", $newsletter->getPersonas());
            if ($class->getFieldDefinition("persona") instanceof \Pimcore\Model\Object\ClassDefinition\Data\Persona) {
                foreach ($p as $value) {
                    if (!empty($value)) {
                        $personas[] = $list->quote($value);
                    }
                }
                $conditions[] = "persona IN (" . implode(",", $personas) . ")";
            } else {
                if ($class->getFieldDefinition("persona") instanceof \Pimcore\Model\Object\ClassDefinition\Data\Personamultiselect) {
                    $personasCondition = array();
                    foreach ($p as $value) {
                        $personasCondition[] = "persona LIKE " . $list->quote("%," . $value . ",%");
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:31,代码来源:send-newsletter.php


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