dev/core#2046 Fix Phone:add to be a pseudonym for Phone.create #18588
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
Per https://lab.civicrm.org/dev/core/-/issues/2046 we have discussed rationalising add vs create
In the case of phone making this change only affects one place - a place that currently has a
bug that relates specifically to the handling of is_primary & which is more solvable by
calling create with it's extra is_primary handling.
Before
Phone::create calls Phone::add, duplicating
CRM_Core_DAO::checkSqlFunctionsExist();
Phone::add does not handle 'is_primary'
After
CRM_Core_DAO::checkSqlFunctionsExist();
only called once - see https://lab.civicrm.org/dev/core/-/issues/27 for further proposal. is_primary handled in add which calls create & is deprecatedTechnical Details
Comments
The related bug is that the is_primary handling in Block::create is unreliable &
to mitigate that we are doing an additional 10 queries on every contact create - so
handling is_primary right in the first place helps address that - see https://lab.civicrm.org/dev/core/-/issues/2039