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


PHP Util::getNaming方法代码示例

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


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

示例1: testGetNaming

 public function testGetNaming()
 {
     $this->assertEquals('myPrefixMyName', Util::getNaming('myName', 'myPrefix', 'prefix'));
     $this->assertEquals('myNameMyPostfix', Util::getNaming('myName', 'myPostfix', 'postfix'));
     $this->assertEquals('myNameMyPostfix', Util::getNaming('my_name', 'myPostfix', 'postfix', '_'));
     $this->assertEquals('myNameMyPostfix', Util::getNaming('my_name', 'my_postfix', 'postfix', '_'));
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:7,代码来源:UtilTest.php

示例2: getForeignField

 /**
  * Get Foreign field
  *
  * @param  string $name
  * @param  string $entityName
  * @return string
  */
 protected function getForeignField($name, $entityName)
 {
     $foreignField = $this->getMetadata()->get('entityDefs.' . $entityName . '.fields.' . $name);
     if ($foreignField['type'] != 'varchar') {
         $fieldDefs = $this->getMetadata()->get('fields.' . $foreignField['type']);
         $naming = isset($fieldDefs['naming']) ? $fieldDefs['naming'] : 'postfix';
         if (isset($fieldDefs['actualFields']) && is_array($fieldDefs['actualFields'])) {
             $foreignFieldArray = array();
             foreach ($fieldDefs['actualFields'] as $fieldName) {
                 if ($fieldName != 'salutation') {
                     $foreignFieldArray[] = Util::getNaming($name, $fieldName, $naming);
                 }
             }
             return explode('|', implode('| |', $foreignFieldArray));
             //add an empty string between items
         }
     }
     return $name;
 }
开发者ID:jdavis593,项目名称:appitechture,代码行数:26,代码来源:Base.php

示例3: convertActualFields

 protected function convertActualFields($entityName, $fieldName, $fieldParams, $subFieldName, $fieldTypeMeta)
 {
     $subField = array();
     $subField['params'] = $this->getInitValues($fieldParams);
     if (isset($fieldTypeMeta['fieldDefs'])) {
         $subField['params'] = Util::merge($subField['params'], $fieldTypeMeta['fieldDefs']);
     }
     //if empty field name, then use the main field
     if (trim($subFieldName) == '') {
         if (!isset($fieldTypeMeta['fieldDefs'])) {
             $GLOBALS['log']->critical('Empty field defs for [' . $entityName . ':' . $fieldName . '] using "actualFields". Main field [' . $fieldName . ']');
         }
         $subField['name'] = $fieldName;
         $subField['naming'] = $fieldName;
     } else {
         if (!isset($fieldTypeMeta['fields'][$subFieldName])) {
             $GLOBALS['log']->critical('Empty field defs for [' . $entityName . ':' . $subFieldName . '] using "actualFields". Main field [' . $fieldName . ']');
         }
         $namingType = isset($fieldTypeMeta['naming']) ? $fieldTypeMeta['naming'] : $this->defaultNaming;
         $subField['name'] = $subFieldName;
         $subField['naming'] = Util::getNaming($fieldName, $subFieldName, $namingType);
         if (isset($fieldTypeMeta['fields'][$subFieldName])) {
             $subField['params'] = Util::merge($subField['params'], $fieldTypeMeta['fields'][$subFieldName]);
         }
     }
     return $subField;
 }
开发者ID:jdavis593,项目名称:appitechture,代码行数:27,代码来源:Converter.php

示例4: getAdditionalFieldList

 /**
  * Get additional field list based on field definition in metadata 'fields'
  *
  * @param  string     $fieldName
  * @param  array     $fieldParams
  * @param  array|null $definitionList
  *
  * @return array
  */
 public function getAdditionalFieldList($fieldName, array $fieldParams, array $definitionList = null)
 {
     if (empty($fieldParams['type'])) {
         return;
     }
     $fieldType = $fieldParams['type'];
     $fieldDefinition = isset($definitionList[$fieldType]) ? $definitionList[$fieldType] : $this->getMetadata()->get('fields.' . $fieldType);
     if (!empty($fieldDefinition['fields']) && is_array($fieldDefinition['fields'])) {
         $copiedParams = array_intersect_key($fieldParams, array_flip($this->copiedDefParams));
         $additionalFields = array();
         //add additional fields
         foreach ($fieldDefinition['fields'] as $subFieldName => $subFieldParams) {
             $namingType = isset($fieldDefinition['naming']) ? $fieldDefinition['naming'] : $this->defaultNaming;
             $subFieldNaming = Util::getNaming($fieldName, $subFieldName, $namingType);
             $additionalFields[$subFieldNaming] = array_merge($copiedParams, $subFieldParams);
         }
         return $additionalFields;
     }
 }
开发者ID:mehulsbhatt,项目名称:espocrm,代码行数:28,代码来源:Helper.php


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