Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/availableplugins/Transmogrify/config/schema/tables.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
"fieldMap": {
"org_identity_source_id": "external_identity_source_id",
"redirect_on_duplicate": "redirect_on_duplicate",
"sp_type": "sp_mode",
"mva_delimiter": "&mapFromSpType",
"default_affiliation_type_id": "&mapAffiliationType",
"address_type_id": "&mapToDefaultAddressTypeId",
"email_address_type_id": "&mapToDefaultEmailAddressTypeId",
Expand All @@ -305,7 +305,8 @@
"env_identifier_sorid_login": null,
"env_identifier_network_login": null,
"duplicate_mode": null,
"default_affiliation": null
"default_affiliation": null,
"sp_type": null
},
"dependencies": ["external_identity_sources", "types"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,22 @@ public function execute(Arguments $args, ConsoleIo $io): int
}
$this->cmdPrinter->warning("Skipping $t record " . (string)$rowIdLabel . ": " . $e->getMessage());
// $this->cmdPrinter->pause();
} catch (\Doctrine\DBAL\Exception\NotNullConstraintViolationException $e) {
$this->cache['error'] += 1;
if (isset($row['id'])) {
$this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row;
}
$rowIdLabel = $row['id'] ?? ($this->tables[$t]['displayField'] ?? 'n/a');
$this->cmdPrinter->error("Missing required field for $t record " . (string)$rowIdLabel . ". DB Error: " . $e->getMessage());
$this->cmdPrinter->pause();
} catch (\Doctrine\DBAL\Exception\InvalidFieldNameException $e) {
$this->cache['error'] += 1;
if (isset($row['id'])) {
$this->cache['rejected'][$outboundQualifiedTableName][$row['id']] = $row;
}
$rowIdLabel = $row['id'] ?? ($this->tables[$t]['displayField'] ?? 'n/a');
$this->cmdPrinter->error("Schema mapping mismatch for $t. A mapped column doesn't exist. DB Error: " . $e->getMessage());
$this->cmdPrinter->pause();
} catch (\Exception $e) {
$this->cache['error'] += 1;
if (isset($row['id'])) {
Expand Down Expand Up @@ -570,15 +586,16 @@ public function execute(Arguments $args, ConsoleIo $io): int
// Display total execution time
$executionTime = microtime(true) - $this->startTime;

$hours = floor($executionTime / 3600);
$minutes = floor(($executionTime % 3600) / 60);
$seconds = $executionTime % 60;
$executionTimeInt = (int)$executionTime;
$hours = (int)floor($executionTimeInt / 3600);
$minutes = (int)floor(($executionTimeInt % 3600) / 60);
$seconds = $executionTimeInt % 60;

$formatted = sprintf(
'%02d:%02d:%02d',
(int)$hours,
(int)$minutes,
(int)$seconds
$hours,
$minutes,
$seconds
);

$this->cmdPrinter->out(sprintf('Total execution time: %s (HH:MM:SS)', $formatted));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Transmogrify\Lib\Util\RawSqlQueries;
use App\Lib\Enum\MatchStrategyEnum;
use EnvSource\Lib\Enum\EnvSourceSpModeEnum;

/**
* Encapsulates all type mapping logic and helpers (map_type + specific wrappers).
Expand Down Expand Up @@ -944,6 +945,31 @@ protected function mapAlgorithmToPlugin(array $row): ?string
};
}


/**
* Map v4 SP type to v5 attribute separator character.
*
* Converts EnvSource SP mode enum to the appropriate delimiter:
* - Shibboleth uses semicolon (;)
* - SimpleSamlPhp uses comma (,)
* - Other/default uses semicolon (;)
*
* @param array $row Row data containing 'sp_type' from cm_env_sources
* @return string|null Delimiter character (';' or ',')
* @since COmanage Registry v5.3.0
*/
protected function mapFromSpType(array $row): ?string
{
$spType = $row['sp_type'] ?? null;

// Default to ';' (matching the UpgradeCommand behavior for legacy Other modes)
return match ($spType) {
EnvSourceSpModeEnum::Shibboleth => ';',
EnvSourceSpModeEnum::SimpleSamlPhp => ',',
default => ';',
};
}

/**
* Map a type value to its corresponding ID
*
Expand Down