$this->renameLabels();
$this->_sethtmlGlobals();
+ $this->ensureMySQLMode(['IGNORE_SPACE', 'ERROR_FOR_DIVISION_BY_ZERO', 'STRICT_TRANS_TABLES']);
}
/**
* Read everything from the datasets directory and insert into the db.
*/
- public function loadAllFixtures() {
+ public function loadAllFixtures(): void {
$fixturesDir = __DIR__ . '/../../fixtures';
CRM_Core_DAO::executeQuery("SET FOREIGN_KEY_CHECKS = 0;");
'));
}
+ /**
+ * Ensure the specified mysql mode/s are activated.
+ *
+ * @param array $modes
+ */
+ protected function ensureMySQLMode(array $modes): void {
+ $currentModes = array_fill_keys(CRM_Utils_SQL::getSqlModes(), 1);
+ $currentModes = array_merge($currentModes, array_fill_keys($modes, 1));
+ CRM_Core_DAO::executeQuery("SET GLOBAL sql_mode = '" . implode(',', array_keys($currentModes)) . "'");
+ }
+
}