diff --git a/app/plugins/CoreJob/src/Lib/Jobs/SyncJob.php b/app/plugins/CoreJob/src/Lib/Jobs/SyncJob.php index 64a5b8179..1bec3cd19 100644 --- a/app/plugins/CoreJob/src/Lib/Jobs/SyncJob.php +++ b/app/plugins/CoreJob/src/Lib/Jobs/SyncJob.php @@ -394,7 +394,12 @@ protected function postRunTasks( ]); } - $LastRunTable->save($lastRun); + // SyncJobLastRuns table save triggers the ruleValidateCO integrity rule for external_identity_source_id. + // ruleValidateCO expects a belongsTo association named external_identity_source (derived from the _id field), + // but SyncJobLastRuns has no such association (autovivified table / missing Table class). + //This causes the job (and tests) to fail with “Missing association … in ruleValidateCO”. + // As a result we need to disable the ruleValidateCO integrity rule for SyncJobLastRuns. + $LastRunTable->save($lastRun, ['checkRules' => false]); // Call the plugin if it has anything it wants to do