dev/core#2046 Fix Phone:add to be a pseudonym for Phone.create
authoreileen <emcnaughton@wikimedia.org>
Thu, 24 Sep 2020 23:31:39 +0000 (11:31 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 25 Sep 2020 01:47:11 +0000 (13:47 +1200)
commit717c29031d968c0bbb3b115ee63f3769b53ec7bc
tree7dac7c44106d9526bc95f264c1520fe2a854f0dc
parent64c8be5d48c404a3dc41f3db41ddee18366fb0da
dev/core#2046 Fix Phone:add to be a pseudonym for Phone.create

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.

(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)
CRM/Core/BAO/Block.php
CRM/Core/BAO/Phone.php
tests/phpunit/CRM/Contact/BAO/ContactTest.php
tests/phpunit/CRM/Core/BAO/PhoneTest.php