-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
[REF] Move daoName generation so we don't need to pass the variable name #18552
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1820,7 +1820,7 @@ public static function mergeLocations($mergeHandler) { | |
if (!$otherBlockId) { | ||
continue; | ||
} | ||
$otherBlockDAO = $mergeHandler->copyDataToNewBlockDAO($daoName, $otherBlockId, $name, $blkCount); | ||
$otherBlockDAO = $mergeHandler->copyDataToNewBlockDAO($otherBlockId, $name, $blkCount); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like line 1812 above (which defines the now-unused variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @colemanw - yes - removing that in this PR makes it confllct with the one in the PR template |
||
|
||
// If we're deliberately setting this as primary then add the flag | ||
// and remove it from the current primary location (if there is one). | ||
|
@@ -1829,7 +1829,7 @@ public static function mergeLocations($mergeHandler) { | |
if (!$changePrimary && $set_primary == "1") { | ||
$otherBlockDAO->is_primary = 1; | ||
if ($primaryDAOId) { | ||
$removePrimaryDAO = new $daoName(); | ||
$removePrimaryDAO = $mergeHandler->getDAOForLocationEntity($name); | ||
$removePrimaryDAO->id = $primaryDAOId; | ||
$removePrimaryDAO->is_primary = 0; | ||
$blocksDAO[$name]['update'][$primaryDAOId] = $removePrimaryDAO; | ||
|
@@ -1848,7 +1848,7 @@ public static function mergeLocations($mergeHandler) { | |
|
||
// overwrite - need to delete block which belongs to main-contact. | ||
if (!empty($mainBlockId) && $values['is_replace']) { | ||
$deleteDAO = new $daoName(); | ||
$deleteDAO = $mergeHandler->getDAOForLocationEntity($name); | ||
$deleteDAO->id = $mainBlockId; | ||
$deleteDAO->find(TRUE); | ||
|
||
|
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.
Hmm, I just removed a long
switch
statement like this in #18546. Aside from the$entity
being the nonstandard lowercase, is there any reason not to do it this way?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.
@colemanw yeah - the follow on patches do more by adding extra variables in there
As an aside, I think a switch in it's own function is not bad for readability - it's the long switch in the midst of a function that is