Skip to content

Commit

Permalink
fix: integration mode mapping in upgrade wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
maikschneider committed Dec 16, 2024
1 parent bd92a9b commit b178f49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Classes/Dto/IntegrationMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ public static function fromDatabase($value): self
};
}

public function forDatabase(): int
{
return match ($this) {
self::Integrated => 1,
self::AjaxTypo3 => 2,
self::AjaxFormcycle => 3,
self::Iframe => 4,
default => 0,
};
}

public static function fromSiteSettings($value): self
{
return match ($value) {
Expand Down
3 changes: 2 additions & 1 deletion Classes/Updates/FlexformMigrationWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
use TYPO3\CMS\Install\Updates\RepeatableInterface;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
use Xima\XmFormcycle\Dto\IntegrationMode;

#[UpgradeWizard('xmFormcycle_flexformMigration')]
readonly class FlexformMigrationWizard implements UpgradeWizardInterface, RepeatableInterface
Expand Down Expand Up @@ -40,7 +41,7 @@ public function executeUpdate(): bool
$flexformValues = [
'tx_xmformcycle_redirect_success' => $piFlexform['settings']['xf']['siteok'] ?? null,
'tx_xmformcycle_redirect_error' => $piFlexform['settings']['xf']['siteerror'] ?? null,
'tx_xmformcycle_integration_mode' => $piFlexform['settings']['xf']['integrationMode'] ?? null,
'tx_xmformcycle_integration_mode' => IntegrationMode::tryFrom($piFlexform['settings']['xf']['integrationMode'])?->forDatabase(),
'tx_xmformcycle_is_jquery' => $piFlexform['settings']['xf']['useFcjQuery'] ?? null,
'tx_xmformcycle_is_jquery_ui' => $piFlexform['settings']['xf']['useFcjQueryUi'] ?? null,
'tx_xmformcycle_additional_params' => $piFlexform['settings']['xf']['useFcUrlParams'] ?? null,
Expand Down

0 comments on commit b178f49

Please sign in to comment.