DatabaseStorageAdapter implements StorageAdapterInterface
Storage adapter for database-based form persistence
Scope: frontend / backend
Table of Contents
Interfaces
- StorageAdapterInterface
- Storage adapter interface for form persistence
Methods
- __construct() : mixed
- delete() : void
- Delete form definition from storage
- exists() : bool
- Check if form definition exists in storage
- existsByFormIdentifier() : bool
- Check if a form with the given form identifier (not persistence identifier) exists
- findAll() : array<string|int, FormMetadata>
- Find all form definitions for listing.
- getDescription() : string
- Get the description for this storage type
- getFormManagerOptions() : array<string|int, mixed>
- Get options for the form manager interface
- getIconIdentifier() : string
- Get the icon identifier for this storage type
- getLabel() : string
- Get the human-readable label for this storage type
- getPriority() : int
- Get priority for capability checking
- getTypeIdentifier() : string
- Get unique identifier for this storage type
- getUniquePersistenceIdentifier() : string
- Get unique persistence identifier for a new form in this storage
- isAccessible() : bool
- Check if this storage is currently accessible
- isAllowedPersistenceIdentifier() : bool
- Check if a persistence identifier is allowed for this adapter
- isAllowedStorageLocation() : bool
- Check if a storage location is allowed for this adapter
- read() : FormData
- Read form definition from storage
- supports() : bool
- Check if this adapter can handle the given persistence identifier
- write() : FormIdentifier
- Write form definition to storage
Methods
__construct()
public
__construct(FormDefinitionRepository $repository, DatabasePermissionChecker $permissionChecker) : mixed
Parameters
- $repository : FormDefinitionRepository
- $permissionChecker : DatabasePermissionChecker
delete()
Delete form definition from storage
public
delete(FormIdentifier $identifier) : void
Parameters
- $identifier : FormIdentifier
Tags
exists()
Check if form definition exists in storage
public
exists(FormIdentifier $identifier) : bool
Parameters
- $identifier : FormIdentifier
Tags
Return values
boolexistsByFormIdentifier()
Check if a form with the given form identifier (not persistence identifier) exists
public
existsByFormIdentifier(string $formIdentifier) : bool
This is used for efficient duplicate identifier checking without loading all forms. The form identifier is the logical name (e.g., "contact-form"), not the persistence identifier (e.g., UID or file path).
Parameters
- $formIdentifier : string
-
The form identifier to check (e.g., "contact-form")
Return values
bool —True if a form with this identifier exists in this storage
findAll()
Find all form definitions for listing.
public
findAll(SearchCriteria $criteria) : array<string|int, FormMetadata>
Uses findAllForListing() which only selects metadata columns (uid, pid, identifier, label) instead of the full configuration JSON. This avoids loading and parsing potentially large JSON blobs just for the form listing view.
Parameters
- $criteria : SearchCriteria
Return values
array<string|int, FormMetadata>getDescription()
Get the description for this storage type
public
getDescription() : string
Return values
string —translation key
getFormManagerOptions()
Get options for the form manager interface
public
getFormManagerOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getIconIdentifier()
Get the icon identifier for this storage type
public
getIconIdentifier() : string
Return values
string —icon identifier
getLabel()
Get the human-readable label for this storage type
public
getLabel() : string
Return values
string —translation key
getPriority()
Get priority for capability checking
public
getPriority() : int
Higher priority adapters are checked first. Allows extensions to override core adapters by providing higher priority.
Suggested ranges:
- 0-49: Low priority / fallback adapters
- 50-99: Normal priority (file mounts, database)
- 100+: High priority (extension paths, specific handlers)
Return values
int —Priority (higher = checked first)
getTypeIdentifier()
Get unique identifier for this storage type
public
getTypeIdentifier() : string
Used for metadata, display, and debugging purposes. Examples: 'extension', 'filemount', 'database'
Return values
string —Unique type identifier (lowercase, alphanumeric + underscore)
getUniquePersistenceIdentifier()
Get unique persistence identifier for a new form in this storage
public
getUniquePersistenceIdentifier(string $formIdentifier, string $storageLocation) : string
Parameters
- $formIdentifier : string
-
The form identifier (e.g., "contact-form")
- $storageLocation : string
-
The save path (e.g., "1:/forms/" for filemount, pid for database)
Return values
string —Unique persistence identifier
isAccessible()
Check if this storage is currently accessible
public
isAccessible() : bool
Return values
boolisAllowedPersistenceIdentifier()
Check if a persistence identifier is allowed for this adapter
public
isAllowedPersistenceIdentifier(string $persistenceIdentifier) : bool
For database storage: identifier is a UID or NEW* For file storage: identifier is a full file path (e.g., "1:/forms/contact.form.yaml")
Parameters
- $persistenceIdentifier : string
-
The persistence identifier to check
Return values
bool —True if the persistence identifier is allowed
isAllowedStorageLocation()
Check if a storage location is allowed for this adapter
public
isAllowedStorageLocation(string $storageLocation) : bool
For database storage: storageLocation is a PID For file storage: storageLocation is a folder path (e.g., "1:/forms/")
Parameters
- $storageLocation : string
-
The storage location to check
Return values
bool —True if the storage location is allowed
read()
Read form definition from storage
public
read(FormIdentifier $identifier) : FormData
Parameters
- $identifier : FormIdentifier
Tags
Return values
FormDatasupports()
Check if this adapter can handle the given persistence identifier
public
supports(string $identifier) : bool
Parameters
- $identifier : string
-
Persistence identifier (e.g., "EXT:my_extension/Forms/contact.form.yaml", "1:/forms/contact.form.yaml")
Return values
bool —True if this adapter can handle the identifier
write()
Write form definition to storage
public
write(FormIdentifier $identifier, FormData $data[, StorageContext|null $context = null ]) : FormIdentifier
Parameters
- $identifier : FormIdentifier
- $data : FormData
- $context : StorageContext|null = null
-
Additional storage context (e.g., PID for database storage)
Tags
Return values
FormIdentifier —The identifier of the saved form (might differ for new forms in database storage)