Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenCode - When generating boilerplate code from xml, make error text more helpful and spelt correckly #20054

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CRM/Core/CodeGen/Specification.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,15 +532,15 @@ public function getPrimaryKey(&$primaryXML, &$fields, &$table) {
// all fieldnames have to be defined and should exist in schema.
foreach ($primaryKey['field'] as $fieldName) {
if (!$fieldName) {
echo "Invalid field defination for index $name\n";
echo "Invalid field definition for index '$name' in table ${table['name']}\n";
return;
}
$parenOffset = strpos($fieldName, '(');
if ($parenOffset > 0) {
$fieldName = substr($fieldName, 0, $parenOffset);
}
if (!array_key_exists($fieldName, $fields)) {
echo "Table does not contain $fieldName\n";
echo "Missing definition of field '$fieldName' for index '$name' in table ${table['name']}\n";
print_r($fields);
exit();
}
Expand Down Expand Up @@ -596,15 +596,15 @@ public function getIndex(&$indexXML, &$fields, &$indices) {
// all fieldnames have to be defined and should exist in schema.
foreach ($index['field'] as $fieldName) {
if (!$fieldName) {
echo "Invalid field defination for index $indexName\n";
echo "Invalid field definition for index '$indexName'\n";
return;
}
$parenOffset = strpos($fieldName, '(');
if ($parenOffset > 0) {
$fieldName = substr($fieldName, 0, $parenOffset);
}
if (!array_key_exists($fieldName, $fields)) {
echo "Table does not contain $fieldName\n";
echo "Missing definition of field '$fieldName' for index '$indexName'. Fields defined:\n";
print_r($fields);
exit();
}
Expand All @@ -623,7 +623,7 @@ public function getForeignKey(&$foreignXML, &$fields, &$foreignKeys, &$currentTa

/** need to make sure there is a field of type name */
if (!array_key_exists($name, $fields)) {
echo "foreign $name in $currentTableName does not have a field definition, ignoring\n";
echo "Foreign key '$name' in $currentTableName does not have a field definition, ignoring\n";
return;
}

Expand Down