From b4983c7ef978967a76f3e5194284a8a5b4d296ba Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Wed, 12 Nov 2025 13:00:07 +0200 Subject: [PATCH] transmogrify petitions --- .../Transmogrify/config/schema/tables.json | 32 ++++++++++++++++++- .../src/Command/TransmogrifyCommand.php | 19 +++++++---- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/app/plugins/Transmogrify/config/schema/tables.json b/app/plugins/Transmogrify/config/schema/tables.json index 9cdb15f19..f3f926b2e 100644 --- a/app/plugins/Transmogrify/config/schema/tables.json +++ b/app/plugins/Transmogrify/config/schema/tables.json @@ -186,7 +186,8 @@ "__NOTES__": "DATA MIGRATIONS", "authentication_events": { "source": "cm_authentication_events", - "displayField": "authenticated_identifier" + "displayField": "authenticated_identifier", + "canSkip": "true" }, "people": { "source": "cm_co_people", @@ -371,6 +372,7 @@ "notifications": { "source": "cm_co_notifications", "displayField": "id", + "canSkip": "true", "addChangelog": true, "fieldMap": { "subject_co_person_id": "subject_person_id", @@ -393,6 +395,7 @@ "source": "cm_history_records", "displayField": "id", "sqlSelect": "historyRecordsSqlSelect", + "canSkip": "true", "fieldMap": { "actor_co_person_id": "actor_person_id", "co_person_id": "person_id", @@ -423,10 +426,37 @@ "source": "cm_co_job_history_records", "displayField": "id", "sqlSelect": "jobHistoryRecordsSqlSelect", + "canSkip": "true", "fieldMap": { "co_job_id": "job_id", "co_person_id": "person_id", "org_identity_id": "external_identity_id" } + }, + "petitions": { + "source": "cm_co_petitions", + "displayField": "authenticated_identifier", + "canSkip": "true", + "fieldMap": { + "co_enrollment_flow_id": null, + "co_id": null, + "cou_id": "cou_id", + "enrollee_org_identity_id": null, + "archived_org_identity_id": null, + "enrollee_co_person_id": "enrollee_person_id", + "enrollee_co_person_role_id": null, + "petitioner_co_person_id": "petitioner_person_id", + "sponsor_co_person_id": null, + "approver_co_person_id": null, + "co_invite_id": null, + "vetting_request_id": null, + "authenticated_identifier": "petitioner_identifier", + "reference_identifier": "enrollee_identifier", + "petitioner_token": "token", + "enrollee_token": null, + "return_url": null, + "approver_comment": null, + "co_petition_id": "petition_id" + } } } diff --git a/app/plugins/Transmogrify/src/Command/TransmogrifyCommand.php b/app/plugins/Transmogrify/src/Command/TransmogrifyCommand.php index b218d365b..ab24f1729 100644 --- a/app/plugins/Transmogrify/src/Command/TransmogrifyCommand.php +++ b/app/plugins/Transmogrify/src/Command/TransmogrifyCommand.php @@ -407,21 +407,28 @@ public function execute(Arguments $args, ConsoleIo $io): int // did not load, perhaps because it was associated with an Org Identity // not linked to a CO Person that was not migrated. $this->cache['warns'] += 1; - $this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row; - $this->cmdPrinter->warning("Skipping $t record " . $row['id'] . " due to invalid foreign key: " . $e->getMessage()); + $rowIdLabel = $row['id'] ?? ($this->tables[$t]['displayField'] ?? 'n/a'); + if (isset($row['id'])) { + $this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row; + } + $this->cmdPrinter->warning("Skipping $t record " . (string)$rowIdLabel . " due to invalid foreign key: " . $e->getMessage()); $this->cmdPrinter->pause(); } catch(\InvalidArgumentException $e) { // If we can't find a value for mapping we skip the record // (ie: mapLegacyFieldNames basically requires a successful mapping) $this->cache['warns'] += 1; - $this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row; - $this->cmdPrinter->warning("Skipping $t record " . $row['id'] . ": " . $e->getMessage()); + $rowIdLabel = $row['id'] ?? ($this->tables[$t]['displayField'] ?? 'n/a'); + if (isset($row['id'])) { + $this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row; + } + $this->cmdPrinter->warning("Skipping $t record " . (string)$rowIdLabel . ": " . $e->getMessage()); $this->cmdPrinter->pause(); } catch(\Exception $e) { $this->cache['error'] += 1; - $this->cmdPrinter->error("$t record " . $row['id'] . ": " . $e->getMessage()); + $rowIdLabel = $row['id'] ?? ($this->tables[$t]['displayField'] ?? 'n/a'); + $this->cmdPrinter->error("$t record " . (string)$rowIdLabel . ": " . $e->getMessage()); $this->cmdPrinter->pause(); } @@ -723,4 +730,4 @@ private function skipIfRejectedParent(string $currentTable, array $row): bool return false; } -} \ No newline at end of file +}