CreateRecordReaction
class \
- Implements
- ReactionInterface
A reaction that creates a database record based on the payload within a request.
Internal
This is a specific reaction implementation and is not considered part of the Public TYPO3 API.
Table of Contents
Interfaces
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
__construct()
public
__construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory, TcaSchemaFactory $tcaSchemaFactory, ItemProcessingService $itemProcessingService) : mixed
Parameters
- $responseFactory : ResponseFactoryInterface
- $streamFactory : StreamFactoryInterface
- $tcaSchemaFactory : TcaSchemaFactory
- $itemProcessingService : ItemProcessingService
getDescription()
A meaningful description for the reaction
public
static getDescription() : string
Return values
stringgetIconIdentifier()
An icon identifier for the reaction
public
static getIconIdentifier() : string
Return values
stringgetType()
The reaction type, used for the registry and stored in the database
public
static getType() : string
Return values
stringreact()
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
ResponseInterfacereplacePlaceHolders()
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
Internal
only public due to tests
Return values
string|nullresolve()
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
Internal
only public for the dry run of the backend module
Return values
CreateRecordResolutionbuildResponseFromDataHandler()
protected
buildResponseFromDataHandler(DataHandler $dataHandler[, int $successCode = 200 ][, array $skippedFields = [] ]) : ResponseInterface
Parameters
- $dataHandler : DataHandler
- $successCode : int = 200
- $skippedFields : array = []
Return values
ResponseInterfacejsonResponse()
protected
jsonResponse(array $data[, int $statusCode = 200 ]) : ResponseInterface
Parameters
- $data : array
- $statusCode : int = 200