-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
CRM-21574 NFC code cleanup of CRM_Friend_BAO_Friend class #12355
CRM-21574 NFC code cleanup of CRM_Friend_BAO_Friend class #12355
Conversation
(Standard links)
|
Anyone other than @eileenmcnaughton able to review this PR please - it's just code cleanup... @seamuslee001 @michaelmcandrew @monishdeb ?? |
not me at the moment, I'm afraid @mattwire :( |
CRM/Friend/BAO/Friend.php
Outdated
self::getValues($frndParams); | ||
$friendParams = array(); | ||
$friendParams['entity_id'] = $params['entity_id']; | ||
$friendParams['entity_table'] = $params['entity_table']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to
$friendParams = [
'entity_id' => $params['entity_id'],
'entity_table' => $params['entity_table'],
];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
* | ||
* @var int | ||
*/ | ||
public $_friendId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it be protected instead of public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used in public static function buildFriendForm($form) which is called from two other classes (Contribute and Event) so it needs to be public unless we do a lot more work, at which point we would risk breaking things :-)
CRM/Friend/BAO/Friend.php
Outdated
$mailParams['title'] = CRM_Utils_Array::value('title', $params); | ||
$mailParams['general_link'] = CRM_Utils_Array::value('general_link', $frndParams); | ||
$mailParams['general_link'] = CRM_Utils_Array::value('general_link', $friendParams); | ||
$mailParams['message'] = CRM_Utils_Array::value('suggested_message', $params); | ||
|
||
// get domain | ||
$domainDetails = CRM_Core_BAO_Domain::getNameAndEmail(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change it to
- $domainDetails = CRM_Core_BAO_Domain::getNameAndEmail();
+ list($_, $mailParams['email_from']) = CRM_Core_BAO_Domain::getNameAndEmail();
...
- // Default "from email address" is default domain address.
- // This is normally overridden by one of the if statements below
- $mailParams['email_from'] = $domainDetails[1];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - nice cleanup.
5fda8ad
to
4d0bbeb
Compare
Thanks for reviewing @monishdeb I've made changes as requested. |
Overview
Towards #11425. This PR contains the non-functional code changes that cleanup that class.
Before
Less easy to maintain code
After
More easy to maintain code
Comments
Seems to be impossible to get a reviewer for #11425 as I think virtually no-one uses the PCP classes so let's try breaking it down a little.