Add DAO::writeRecord and DAO::deleteRecord methods #16856
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Adds generic save and delete functions to the base DAO class where it is inherited by each BAO.
Before
Generic functions for save & delete in the api layers.
After
Generic functions for save & delete now in the DAO layer where it's more centrally useful.
Technical Details
Per discussion on https://lab.civicrm.org/dev/core/issues/1648 this is with an eye toward deprecating and eventually removing all the ad-hoc
create
,add
, anddel
functions in each BAO, in favor of handling pre/post logic through event listeners.Comments
As the APIv3 code comment said,
"There's an intuitive sense that this behavior should be defined somehow in the BAO/DAO class"
. Now it is :).Honestly I think the main hangup all these years was thinking of a good name for these functions that didn't conflict with any existing BAO function name.