FormTransferService
Service for transferring form definitions between storage backends
Used by the CLI command form:definition:transfer and the
upgrade wizard for migrating file-based forms to database storage.
Handles reading from a source storage adapter, ensuring identifier
uniqueness, and writing to a target storage adapter.
Table of Contents
Methods
- __construct() : mixed
- deleteForm() : void
- Delete a form from a storage
- getAdapter() : StorageAdapterInterface
- Get adapter for a storage type (for validation purposes)
- getAvailableStorageTypes() : array<int, string>
- Get all registered storage type identifiers
- hasStorageType() : bool
- Check if a storage type exists
- listSourceForms() : array<int, FormMetadata>
- List all forms in the given source storage
- readForm() : FormData
- Read a form definition from a source storage
- transferForm() : FormTransferResult
- Transfer a single form from source to target storage
- updateContentElementReferences() : int
- Update tt_content FlexForm references from old persistence identifiers to new ones.
Methods
__construct()
public
__construct(StorageAdapterFactory $storageAdapterFactory, FormPersistenceManagerInterface $formPersistenceManager, ConnectionPool $connectionPool, LoggerInterface $logger) : mixed
Parameters
- $storageAdapterFactory : StorageAdapterFactory
- $formPersistenceManager : FormPersistenceManagerInterface
- $connectionPool : ConnectionPool
- $logger : LoggerInterface
deleteForm()
Delete a form from a storage
public
deleteForm(string $storageType, string $persistenceIdentifier) : void
Parameters
- $storageType : string
- $persistenceIdentifier : string
getAdapter()
Get adapter for a storage type (for validation purposes)
public
getAdapter(string $typeIdentifier) : StorageAdapterInterface
Parameters
- $typeIdentifier : string
Return values
StorageAdapterInterfacegetAvailableStorageTypes()
Get all registered storage type identifiers
public
getAvailableStorageTypes() : array<int, string>
Return values
array<int, string>hasStorageType()
Check if a storage type exists
public
hasStorageType(string $typeIdentifier) : bool
Parameters
- $typeIdentifier : string
Return values
boollistSourceForms()
List all forms in the given source storage
public
listSourceForms(string $sourceType[, string|null $formIdentifier = null ]) : array<int, FormMetadata>
Parameters
- $sourceType : string
- $formIdentifier : string|null = null
Return values
array<int, FormMetadata>readForm()
Read a form definition from a source storage
public
readForm(string $sourceType, string $persistenceIdentifier) : FormData
Parameters
- $sourceType : string
- $persistenceIdentifier : string
Return values
FormDatatransferForm()
Transfer a single form from source to target storage
public
transferForm(FormMetadata $sourceForm, string $sourceType, string $targetType, string $targetLocation[, bool $deleteSource = false ]) : FormTransferResult
Parameters
- $sourceForm : FormMetadata
- $sourceType : string
- $targetType : string
- $targetLocation : string
- $deleteSource : bool = false
Return values
FormTransferResultupdateContentElementReferences()
Update tt_content FlexForm references from old persistence identifiers to new ones.
public
updateContentElementReferences(array<string, string> $migrationMap) : int
Uses DOM/XPath parsing to precisely target only the
settings.persistenceIdentifier field in FlexForm XML, avoiding
false replacements in other fields.
Parameters
- $migrationMap : array<string, string>
-
Old persistenceIdentifier => new persistenceIdentifier
Return values
int —Number of updated content element references