UploadBodyListener
in package
implements
EventSubscriberInterface
Prepares the body parameter of a command such that the parameter is more flexible (e.g. accepts file handles) with the value it accepts but converts it to the correct format for the command. Also looks for a "Filename" parameter.
Table of Contents
Interfaces
- EventSubscriberInterface
- An EventSubscriber knows himself what events he is interested in.
Properties
- $bodyParameter : string
- $commands : array<string|int, mixed>
- $sourceParameter : string
Methods
- __construct() : mixed
- getSubscribedEvents() : array<string|int, mixed>
- Returns an array of event names this subscriber wants to listen to.
- onCommandBeforePrepare() : mixed
- Converts filenames and file handles into EntityBody objects before the command is validated
Properties
$bodyParameter
protected
string
$bodyParameter
The key for the upload body parameter
$commands
protected
array<string|int, mixed>
$commands
The names of the commands of which to modify the body parameter
$sourceParameter
protected
string
$sourceParameter
The key for the source file parameter
Methods
__construct()
public
__construct(array<string|int, mixed> $commands[, string $bodyParameter = 'Body' ][, string $sourceParameter = 'SourceFile' ]) : mixed
Parameters
- $commands : array<string|int, mixed>
-
The commands to modify
- $bodyParameter : string = 'Body'
-
The key for the body parameter
- $sourceParameter : string = 'SourceFile'
-
The key for the source file parameter
getSubscribedEvents()
Returns an array of event names this subscriber wants to listen to.
public
static getSubscribedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed> —The event names to listen to
onCommandBeforePrepare()
Converts filenames and file handles into EntityBody objects before the command is validated
public
onCommandBeforePrepare(Event $event) : mixed
Parameters
- $event : Event
-
Event emitted