-
-
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] Deprecate unnecessary del() functions #21200
Conversation
(Standard links)
|
CRM/Batch/BAO/EntityBatch.php
Outdated
* @return CRM_Batch_DAO_EntityBatch | ||
*/ | ||
public static function del($params) { | ||
if (!is_array($params)) { | ||
$params = ['id' => $params]; | ||
} | ||
$entityBatch = new CRM_Batch_DAO_EntityBatch(); | ||
$entityId = $params['id'] ?? NULL; |
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.
As alarming as this is - I wonder if there is a reason for it
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.
I suspect the "reason" is careless use of CRM_Utils_Array::value()
which historically was used more than necessary, and recently would have been auto-converted to ??
.
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.
Oh fudge I was wrong:
https://github.com/civicrm/civicrm-core/blob/5.40/CRM/Financial/Page/AJAX.php#L473-L483
Ok I've updated the code to lookup the id when needed.
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 I think that is still wrong - I think that is a multiple row delete - perhaps replace that with a v4 api call & standardise delete? (We should do a universe search but could keep it 'liight' since people know they need to use the api for crud functions)
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.
Crap. Ok I'll revert that file from this PR & we can tackle it separate.
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.
good plan
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 the only one that is giving me pause here is EntityBatch - could there be a place where it is called with |
CRM_Utils_Hook::post('delete', 'Campaign', $id, $dao); | ||
|
||
return $result; | ||
return 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.
this one is weird to return bool - silly but OK
OK - what's left looks equivalent to me (or in some cases will add hook calls which is a good thing) |
Overview
This moves us toward a standard delete function for APIv4, by cleaning up and deprecating all the
BAO::del()
functions which do nothing special.Before
Generic functions implemented copy/paste style.
After
Deprecated in favor of a single, tested generic function.