Overview
----------------------------------------
Removes 10 queries from each contact create that are otherwise dealt with elsewhere
Updated version of https://github.com/civicrm/civicrm-core/pull/18477
Before
----------------------------------------
After creating location blocks 2 queries are done for each of the 5 entities to ensure is_primary fields have not been messed up (ie contact has 1 or more phones but none are marked primary or contact has more than one primary phone).
After
----------------------------------------
Queries are removed as location entities are already created correctly
Technical Details
----------------------------------------
This PR is part of a series of PRs to make this possible - best documented at https://lab.civicrm.org/dev/core/-/issues/2039#note_47758
Comments
----------------------------------------
https://lab.civicrm.org/dev/core/-/issues/2039
}
}
- // when we come from a form which displays all the location elements (like the edit form or the inline block
- // elements, we can skip the below check. The below check adds quite a feq queries to an already overloaded
- // form
- if (empty($params['updateBlankLocInfo'])) {
- // make sure contact should have only one primary block, CRM-5051
- self::checkPrimaryBlocks(CRM_Utils_Array::value('contact_id', $params));
- }
-
return $location;
}
*
* @var bool
*/
- protected $isLocationTypesOnPostAssert = FALSE;
+ protected $isLocationTypesOnPostAssert = TRUE;
/**
* Class used for hooks during tests.
*/
private $report_instance;
+ /**
+ * Should location types be checked to ensure primary addresses are correctly assigned after each test.
+ *
+ * We cannot enable this until https://github.com/civicrm/civicrm-core/pull/18555 is merged
+ *
+ * @var bool
+ */
+ protected $isLocationTypesOnPostAssert = FALSE;
+
/**
* Set up for tests.
*/
protected $_entity;
+ /**
+ * Should location types be checked to ensure primary addresses are correctly assigned after each test.
+ *
+ * Turn off for this class as we use DAO methods that bypass business logic. Also, this test class
+ * takes a long time so might be good not to add another check.
+ *
+ * @var bool
+ */
+ protected $isLocationTypesOnPostAssert = FALSE;
+
/**
* Map custom group entities to civicrm components.
* @var array