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


PHP Service::getSystemFields方法代码示例

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


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

示例1: findAction


//.........这里部分代码省略.........
         // 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 = [];
     $bricks = [];
     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
             } elseif (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"));
         // add Localized Fields filtering
         $params = \Zend_Json::decode($this->getParam('filter'));
         $unlocalizedFieldsFilters = [];
         $localizedFieldsFilters = [];
         foreach ($params as $paramConditionObject) {
             //this loop divides filter parameters to localized and unlocalized groups
             $definitionExists = in_array('o_' . $paramConditionObject['property'], Object\Service::getSystemFields()) || $class->getFieldDefinition($paramConditionObject['property']);
             if ($definitionExists) {
                 //TODO: for sure, we can add additional condition like getLocalizedFieldDefinition()->getFieldDefiniton(...
                 $unlocalizedFieldsFilters[] = $paramConditionObject;
             } else {
                 $localizedFieldsFilters[] = $paramConditionObject;
             }
         }
         //get filter condition only when filters array is not empty
         //string statements for divided filters
         $conditionFilters = count($unlocalizedFieldsFilters) ? Object\Service::getFilterCondition(\Zend_Json::encode($unlocalizedFieldsFilters), $class) : null;
         $localizedConditionFilters = count($localizedFieldsFilters) ? Object\Service::getFilterCondition(\Zend_Json::encode($localizedFieldsFilters), $class) : null;
         $join = "";
         foreach ($bricks as $ob) {
             $join .= " LEFT JOIN object_brick_query_" . $ob . "_" . $class->getId();
             $join .= " `" . $ob . "`";
             $join .= " ON `" . $ob . "`.o_id = `object_" . $class->getId() . "`.o_id";
         }
         if (null !== $conditionFilters) {
             //add condition query for non localised fields
             $conditionParts[] = "( id IN (SELECT `object_" . $class->getId() . "`.o_id FROM object_" . $class->getId() . $join . " WHERE " . $conditionFilters . ") )";
         }
         if (null !== $localizedConditionFilters) {
             //add condition query for localised fields
             $conditionParts[] = "( id IN (SELECT `object_localized_data_" . $class->getId() . "`.ooo_id FROM object_localized_data_" . $class->getId() . $join . " WHERE " . $localizedConditionFilters . " GROUP BY ooo_id " . ") )";
         }
     }
     if (is_array($types) and !empty($types[0])) {
         foreach ($types as $type) {
             $conditionTypeParts[] = $db->quote($type);
         }
         if (in_array("folder", $subtypes)) {
             $conditionTypeParts[] = $db->quote('folder');
开发者ID:pimcore,项目名称:pimcore,代码行数:67,代码来源:SearchController.php


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