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


PHP ClassDefinition::getFieldDefinition方法代码示例

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


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

示例1: getFilterCondition

 /**
  *
  * @param string $filterJson
  * @param ClassDefinition $class
  * @return string
  */
 public static function getFilterCondition($filterJson, $class)
 {
     $systemFields = array("o_path", "o_key", "o_id", "o_published", "o_creationDate", "o_modificationDate", "o_fullpath");
     // create filter condition
     $conditionPartsFilters = array();
     if ($filterJson) {
         $db = \Pimcore\Db::get();
         $filters = \Zend_Json::decode($filterJson);
         foreach ($filters as $filter) {
             $operator = "=";
             /**
              * @extjs
              */
             $filterField = $filter["field"];
             $filterOperator = $filter["comparison"];
             if (\Pimcore\Tool\Admin::isExtJS6()) {
                 $filterField = $filter["property"];
                 $filterOperator = $filter["operator"];
             }
             if ($filter["type"] == "string") {
                 $operator = "LIKE";
             } else {
                 if ($filter["type"] == "numeric") {
                     if ($filterOperator == "lt") {
                         $operator = "<";
                     } else {
                         if ($filterOperator == "gt") {
                             $operator = ">";
                         } else {
                             if ($filterOperator == "eq") {
                                 $operator = "=";
                             }
                         }
                     }
                 } else {
                     if ($filter["type"] == "date") {
                         if ($filterOperator == "lt") {
                             $operator = "<";
                         } else {
                             if ($filterOperator == "gt") {
                                 $operator = ">";
                             } else {
                                 if ($filterOperator == "eq") {
                                     $operator = "=";
                                 }
                             }
                         }
                         $filter["value"] = strtotime($filter["value"]);
                     } else {
                         if ($filter["type"] == "list") {
                             $operator = "=";
                         } else {
                             if ($filter["type"] == "boolean") {
                                 $operator = "=";
                                 $filter["value"] = (int) $filter["value"];
                             }
                         }
                     }
                 }
             }
             $field = $class->getFieldDefinition($filterField);
             $brickField = null;
             $brickType = null;
             if (!$field) {
                 // if the definition doesn't exist check for a localized field
                 $localized = $class->getFieldDefinition("localizedfields");
                 if ($localized instanceof ClassDefinition\Data\Localizedfields) {
                     $field = $localized->getFieldDefinition($filterField);
                 }
                 //if the definition doesn't exist check for object brick
                 $keyParts = explode("~", $filterField);
                 if (substr($filterField, 0, 1) == "~") {
                     // not needed for now
                     //                            $type = $keyParts[1];
                     //                            $field = $keyParts[2];
                     //                            $keyid = $keyParts[3];
                 } else {
                     if (count($keyParts) > 1) {
                         $brickType = $keyParts[0];
                         $brickKey = $keyParts[1];
                         $key = self::getFieldForBrickType($class, $brickType);
                         $field = $class->getFieldDefinition($key);
                         $brickClass = Objectbrick\Definition::getByKey($brickType);
                         $brickField = $brickClass->getFieldDefinition($brickKey);
                     }
                 }
             }
             if ($field instanceof ClassDefinition\Data\Objectbricks) {
                 // custom field
                 $db = \Pimcore\Db::get();
                 if (is_array($filter["value"])) {
                     $fieldConditions = array();
                     foreach ($filter["value"] as $filterValue) {
                         $fieldConditions[] = $db->getQuoteIdentifierSymbol() . $brickType . $db->getQuoteIdentifierSymbol() . "." . $brickField->getFilterCondition($filterValue, $operator);
//.........这里部分代码省略.........
开发者ID:elavarasann,项目名称:pimcore,代码行数:101,代码来源:Service.php


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