本文整理汇总了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', '_'));
}
示例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;
}
示例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;
}
示例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;
}
}