FormDefinitionRepository

readonly class \TYPO3\CMS\Form\Domain\Repository\FormDefinitionRepository

Repository class to fetch available form definitions.

Table of Contents

Constants

TABLE_NAME  : mixed = 'form_definition'

Methods

__construct()  : mixed
add()  : int|null
Insert a form definition in the database.
addRaw()  : int|null
Insert a form definition using a raw database insert (no DataHandler).
existsByFormIdentifier()  : bool
Check if a form definition with the given form identifier exists.
findAll()  : array
Find all form definitions with optional search criteria.
findAllForListing()  : array<int, array{uid: int, pid: int, identifier: string, label: string}>
Find all form definitions for listing purposes.
findByUid()  : array|null
Find a form definition by its uid.
findUidByFormIdentifier()  : int|null
Find the UID of a form definition by its form identifier.
remove()  : bool
Removes a form definition completely from the system using DataHandler.
update()  : bool
Update a form definition in the database using DataHandler.

Constants

TABLE_NAME

public mixed TABLE_NAME = 'form_definition'

Methods

add()

Insert a form definition in the database.

public add(string $persistenceIdentifier, int $pid, FormData $formDefinition) : int|null

Parameters

$persistenceIdentifier : string
$pid : int
$formDefinition : FormData

Tags

throws
JsonException

Return values

int|null —

UID of the newly created record or null on failure.

addRaw()

Insert a form definition using a raw database insert (no DataHandler).

public addRaw(int $pid, FormData $formDefinition) : int|null

This method is intended for contexts where DataHandler cannot be used, e.g. the Install Tool upgrade wizard where no backend user is available.

Parameters

$pid : int
$formDefinition : FormData

Return values

int|null —

The UID of the newly created record, or null on failure

existsByFormIdentifier()

Check if a form definition with the given form identifier exists.

public existsByFormIdentifier(string $formIdentifier) : bool

Uses a COUNT query on the indexed identifier column for efficiency.

Parameters

$formIdentifier : string

Return values

bool

findAll()

Find all form definitions with optional search criteria.

public findAll(SearchCriteria $criteria) : array

Returns an array of database rows including full configuration.

Parameters

$criteria : SearchCriteria

Return values

array

findAllForListing()

Find all form definitions for listing purposes.

public findAllForListing(SearchCriteria $criteria) : array<int, array{uid: int, pid: int, identifier: string, label: string}>

Returns only metadata columns (uid, pid, identifier, label) without the potentially large configuration JSON column.

Parameters

$criteria : SearchCriteria

Return values

array<int, array{uid: int, pid: int, identifier: string, label: string}>

findByUid()

Find a form definition by its uid.

public findByUid(int $uid) : array|null

Returns the database row as array or null if not found.

Parameters

$uid : int

Return values

array|null

findUidByFormIdentifier()

Find the UID of a form definition by its form identifier.

public findUidByFormIdentifier(string $formIdentifier) : int|null

Returns the UID of the first matching non-deleted record, or null if not found. Used by the upgrade wizard to check for already-migrated forms.

Parameters

$formIdentifier : string

Return values

int|null

remove()

Removes a form definition completely from the system using DataHandler.

public remove(int $uid) : bool

Parameters

$uid : int

The UID representing the form definition to delete

Return values

bool —

TRUE if the form definition was successfully deleted, FALSE otherwise

update()

Update a form definition in the database using DataHandler.

public update(int $uid, FormData $formDefinition) : bool

Parameters

$uid : int

The UID of the form definition to update

$formDefinition : FormData

Tags

throws
JsonException

Return values

bool —

TRUE if update was successful, FALSE otherwise

On this page