AbstractFileStorageAdapter

AbstractYes

Abstract helper class for file-based form persistence

Provides shared utility methods for file-based storage adapters. Concrete storage adapters must implement StorageAdapterInterface.

Internal

Table of Contents

Constants

FORM_DEFINITION_FILE_EXTENSION  = '.form.yaml'

Properties

$storageRepository  : StorageRepository|null

Methods

exists()  : bool
findAll()  : array<string|int, mixed>
getUniqueIdentifier()  : string
This takes a form identifier and returns a unique identifier for it.
getUniquePersistenceIdentifier()  : string
This takes a form identifier and returns a unique persistence identifier for it.
injectStorageRepository()  : void
checkForDuplicateIdentifier()  : bool
Check if an identifier is already used by a formDefinition.
extractMetaDataFromCouldBeFormDefinition()  : array<string|int, mixed>
generateErrorsIfFormDefinitionIsValidButHasInvalidFileExtension()  : void
hasValidFileExtension()  : bool
looksLikeAFormDefinition()  : bool
looksLikeAFormDefinitionArray()  : bool
Check if array looks like a form definition
matchesCriteria()  : bool
Check if form data matches search criteria

Constants

FORM_DEFINITION_FILE_EXTENSION

public mixed FORM_DEFINITION_FILE_EXTENSION = '.form.yaml'

Properties

Methods

getUniqueIdentifier()

This takes a form identifier and returns a unique identifier for it.

public getUniqueIdentifier(string $identifier) : string

If a formDefinition with the same identifier already exists a suffix is appended until the identifier is unique.

Parameters
$identifier : string
Tags
throws
NoUniqueIdentifierException
Return values
string

unique form identifier

getUniquePersistenceIdentifier()

This takes a form identifier and returns a unique persistence identifier for it.

public getUniquePersistenceIdentifier(string $formIdentifier, string $savePath) : string

By default, this is just similar to the identifier. But if a form with the same persistence identifier already exists a suffix is appended until the persistence identifier is unique.

Parameters
$formIdentifier : string

lowerCamelCased form identifier

$savePath : string

Path where the form should be saved (e.g., "1:/forms/")

Tags
throws
NoUniquePersistenceIdentifierException
Return values
string

unique form persistence identifier (e.g., "1:/forms/contact.form.yaml")

checkForDuplicateIdentifier()

Check if an identifier is already used by a formDefinition.

protected checkForDuplicateIdentifier(string $identifier) : bool
Parameters
$identifier : string
Return values
bool

extractMetaDataFromCouldBeFormDefinition()

protected extractMetaDataFromCouldBeFormDefinition(string $maybeRawFormDefinition) : array<string|int, mixed>
Parameters
$maybeRawFormDefinition : string
Return values
array<string|int, mixed>

generateErrorsIfFormDefinitionIsValidButHasInvalidFileExtension()

protected generateErrorsIfFormDefinitionIsValidButHasInvalidFileExtension(array<string|int, mixed> $formDefinition, string $identifier) : void
Parameters
$formDefinition : array<string|int, mixed>
$identifier : string
Tags
throws
PersistenceManagerException

hasValidFileExtension()

protected hasValidFileExtension(string $identifier) : bool
Parameters
$identifier : string
Return values
bool

looksLikeAFormDefinitionArray()

Check if array looks like a form definition

protected looksLikeAFormDefinitionArray(array<string|int, mixed> $data) : bool
Parameters
$data : array<string|int, mixed>
Return values
bool

        
On this page

Search results