mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
fix:修复远程下拉多选字段后缀不为 _ids 时会生成重复方法的问题 close #I7OQMR
This commit is contained in:
parent
4ea626d307
commit
e6b75b5b50
@ -564,7 +564,12 @@ class Crud extends Backend
|
||||
$columns = Helper::parseTableColumns($field['form']['remote-table'], true);
|
||||
$relationFields = explode(',', $field['form']['relation-fields']);
|
||||
$tableName = TableManager::tableName($field['form']['remote-table'], false);
|
||||
$relationName = parse_name(preg_replace('/(.*)(_ids|_id)$/', '$1', $field['name']), 1, false);
|
||||
$rnPattern = '/(.*)(_ids|_id)$/';
|
||||
if (preg_match($rnPattern, $field['name'])) {
|
||||
$relationName = parse_name(preg_replace($rnPattern, '$1', $field['name']), 1, false);
|
||||
} else {
|
||||
$relationName = parse_name($field['name'] . '_table', 1, false);
|
||||
}
|
||||
|
||||
// 建立关联模型代码文件
|
||||
if (!$field['form']['remote-model'] || !file_exists(root_path() . $field['form']['remote-model'])) {
|
||||
|
Loading…
Reference in New Issue
Block a user