dev/core#2057 Remove select query that never or almost never finds something.
authoreileen <emcnaughton@wikimedia.org>
Wed, 23 Sep 2020 02:06:46 +0000 (14:06 +1200)
committereileen <emcnaughton@wikimedia.org>
Thu, 24 Sep 2020 01:51:48 +0000 (13:51 +1200)
commit8293f7c2c397db650b65448b10d09f6542ba4ba1
tree4284cb162c84fbac4068d381929b59f88af3971f
parentaca8079b0944e410f830d5cb53bd84d69f18a1d8
dev/core#2057 Remove select query that never or almost never finds something.

When it comes to quey efficiency it's good to do an extra select if it saves an update/insert
but not if it never does. To test the theory that this 'never does' I put
removing this select through the entire test suite. No tests failed, meaning
it was unnecessary 100% of the time. Adding the catch ensures
it will still succeed if it the row exists but we have moved our query conservation
from doing an extraneous select in 99.9% of cases to an extraneous update in .1% of cases

https://lab.civicrm.org/dev/core/-/issues/2057
CRM/Activity/BAO/ActivityContact.php
tests/phpunit/api/v3/ActivityContactTest.php