CreateRecordReaction

class \TYPO3\CMS\Reactions\Reaction\CreateRecordReaction

Implements
ReactionInterface

A reaction that creates a database record based on the payload within a request.

Table of Contents

Interfaces

ReactionInterface

Constants

PLACEHOLDER_PATTERN  : string = '/\$\{([^\}]*)\}/'
A placeholder of the field map, "${path.in.payload}", with the path as its only group.

Methods

__construct()  : mixed
getDescription()  : string
A meaningful description for the reaction
getIconIdentifier()  : string
An icon identifier for the reaction
getType()  : string
The reaction type, used for the registry and stored in the database
react()  : ResponseInterface
Main method of the reaction, handling the incoming request
replacePlaceHolders()  : string|null
Returns null where a placeholder cannot be resolved. The field is then left out of the datamap entirely, so the default of the table applies, rather than the record being written with a literal "${...}" in it.
resolve()  : CreateRecordResolution
Composes the record react() writes for this payload, without writing it.
buildResponseFromDataHandler()  : ResponseInterface
jsonResponse()  : ResponseInterface

Constants

PLACEHOLDER_PATTERN

A placeholder of the field map, "${path.in.payload}", with the path as its only group.

public string PLACEHOLDER_PATTERN = '/\$\{([^\}]*)\}/'

Methods

getDescription()

A meaningful description for the reaction

public static getDescription() : string

Return values

string

getIconIdentifier()

An icon identifier for the reaction

public static getIconIdentifier() : string

Return values

string

getType()

The reaction type, used for the registry and stored in the database

public static getType() : string

Return values

string

react()

Main method of the reaction, handling the incoming request

public react(ServerRequestInterface $request, array $payload, ReactionInstruction $reaction) : ResponseInterface

Parameters

$request : ServerRequestInterface
$payload : array
$reaction : ReactionInstruction

Return values

ResponseInterface

replacePlaceHolders()

Returns null where a placeholder cannot be resolved. The field is then left out of the datamap entirely, so the default of the table applies, rather than the record being written with a literal "${...}" in it.

public replacePlaceHolders(mixed $value, array $payload) : string|null

Parameters

$value : mixed
$payload : array

Return values

string|null

resolve()

Composes the record react() writes for this payload, without writing it.

public resolve(array $payload, ReactionInstruction $reaction, BackendUserAuthentication $user) : CreateRecordResolution

The field permissions are checked for the user handed in. Item processors of a field still read $GLOBALS['BE_USER'], so a caller resolving as a user other than the global one has to set it up there as well. What DataHandler would still reject is not known here.

Parameters

$payload : array
$reaction : ReactionInstruction
$user : BackendUserAuthentication

Return values

CreateRecordResolution

buildResponseFromDataHandler()

protected buildResponseFromDataHandler(DataHandler $dataHandler[, int $successCode = 200 ][, array $skippedFields = [] ]) : ResponseInterface

Parameters

$dataHandler : DataHandler
$successCode : int = 200
$skippedFields : array = []

Return values

ResponseInterface

jsonResponse()

protected jsonResponse(array $data[, int $statusCode = 200 ]) : ResponseInterface

Parameters

$data : array
$statusCode : int = 200

Return values

ResponseInterface
On this page