From 0538550888f99eed5365d1b70585f91437b7433d Mon Sep 17 00:00:00 2001 From: colemanw Date: Tue, 2 Jan 2024 21:00:14 -0500 Subject: [PATCH] Add FKColumnName to fields metadata This supports https://github.com/civicrm/civicrm-core/pull/28827 by adding the extra bit of info it needs. --- .../Command/AddEntityBoilerplateCommand.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/CRM/CivixBundle/Command/AddEntityBoilerplateCommand.php b/src/CRM/CivixBundle/Command/AddEntityBoilerplateCommand.php index 6036aa49..f3a7794c 100644 --- a/src/CRM/CivixBundle/Command/AddEntityBoilerplateCommand.php +++ b/src/CRM/CivixBundle/Command/AddEntityBoilerplateCommand.php @@ -191,16 +191,9 @@ private function resolveForeignKeys(&$tables) { foreach ($tables as &$table) { if (isset($table['foreignKey'])) { foreach ($table['foreignKey'] as &$key) { - if (isset($tables[$key['table']])) { - $key['className'] = $tables[$key['table']]['className']; - $key['fileName'] = $tables[$key['table']]['fileName']; - $table['fields'][$key['name']]['FKClassName'] = $key['className']; - } - else { - $key['className'] = \CRM_Core_DAO_AllCoreTables::getClassForTable($key['table']); - $key['fileName'] = $key['className'] . '.php'; - $table['fields'][$key['name']]['FKClassName'] = $key['className']; - } + $key['className'] = $tables[$key['table']]['className'] ?? \CRM_Core_DAO_AllCoreTables::getClassForTable($key['table']); + $table['fields'][$key['name']]['FKClassName'] = $key['className']; + $table['fields'][$key['name']]['FKColumnName'] = $key['key']; } } }