Skip to content

Commit

Permalink
Merge pull request #328 from colemanw/referenceColumns
Browse files Browse the repository at this point in the history
Add FKColumnName to fields metadata
  • Loading branch information
totten authored Jan 25, 2024
2 parents 15a7589 + 0538550 commit 5ea1146
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/CRM/CivixBundle/Command/AddEntityBoilerplateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
}
}
Expand Down

0 comments on commit 5ea1146

Please sign in to comment.