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

NFC Fix DAO Style issues #14307

Merged
merged 1 commit into from
May 23, 2019
Merged

Conversation

seamuslee001
Copy link
Contributor

No description provided.

@civibot
Copy link

civibot bot commented May 23, 2019

(Standard links)

@civibot civibot bot added the master label May 23, 2019
@@ -30,7 +30,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
{foreach from=$table.fields item=field}
/**
{if $field.comment}
* {$field.comment}
* {$field.comment|replace:"\n":"\n* "}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a regex replace that also removed the extra whitespace would be super cool. Would this work?

|preg_replace:"/\n[ ]*/":"\n* "

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colemanw that gives me Delimiter must not be alphanumeric or backslash

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, looks like it should be |regex_replace
https://www.smarty.net/docsv2/en/language.modifier.regex.replace.tpl

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to have worked @colemanw

@@ -84,6 +84,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
/**
* May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
*
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm - this seems wrong - two lines

@@ -30,7 +30,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
{foreach from=$table.fields item=field}
/**
{if $field.comment}
* {$field.comment}
* {$field.comment|regex_replace:"/\n[ ]*/":"\n* "}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 this looks like the comment change - but where are the trailing commas coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton its for the fact there are multiline comments in the xml schema and we need to add a * for each new line

Remove excess whitespace with Coleman's regex replace

Remove unneeded whitespace
@@ -30,7 +30,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
{foreach from=$table.fields item=field}
/**
{if $field.comment}
* {$field.comment}
* {$field.comment|regex_replace:"/\n[ ]*/":"\n* "}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton its for the fact there are multiline comments in the xml schema and we need to add a * for each new line

@@ -327,7 +327,7 @@ public function getField(&$fieldXML, &$fields) {
$field['sqlType'] = 'decimal(' . $length . ')';
$field['phpType'] = 'float';
$field['crmType'] = 'CRM_Utils_Type::T_MONEY';
$field['precision'] = $length;
$field['precision'] = $length . ',';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton this is the trailing comma change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 Can we not add it in the DAO - feels more consistent with other formatting for DAO files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we can because the $length is also used in L327 etc when generating the SQL file and the SQL doesn't use the trailing ,

@seamuslee001
Copy link
Contributor Author

Jenkins re test this please

@eileenmcnaughton
Copy link
Contributor

As of now formatting changes looking good

@seamuslee001 seamuslee001 merged commit ee69d5a into civicrm:master May 23, 2019
@seamuslee001 seamuslee001 deleted the dao_style branch May 23, 2019 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants