FormDataCollector
extends DataCollector
in package
implements
FormDataCollectorInterface
Data collector for {@link FormInterface} instances.
Tags
Table of Contents
Interfaces
- FormDataCollectorInterface
- Collects and structures information about forms.
Properties
- $data : array<string|int, mixed>|Data
- $cloner : mixed
- $dataByForm : array<string|int, mixed>
- Stores the collected data per {@link FormInterface} instance.
- $dataByView : array<string|int, mixed>
- Stores the collected data per {@link FormView} instance.
- $dataExtractor : mixed
- $formsByView : array<string|int, mixed>
- Connects {@link FormView} with {@link FormInterface} instances.
Methods
- __construct() : mixed
- __sleep() : array<string|int, mixed>
- __wakeup() : mixed
- associateFormWithView() : mixed
- Specifies that the given objects represent the same conceptual form.
- buildFinalFormTree() : mixed
- Assembles the data collected about the given form and its children as a tree-like data structure.
- buildPreliminaryFormTree() : mixed
- Assembles the data collected about the given form and its children as a tree-like data structure.
- collect() : mixed
- Does nothing. The data is collected during the form event listeners.
- collectConfiguration() : mixed
- Stores configuration data of the given form and its children.
- collectDefaultData() : mixed
- Stores the default data of the given form and its children.
- collectSubmittedData() : mixed
- Stores the submitted data of the given form and its children.
- collectViewVariables() : mixed
- Stores the view variables of the given form view and its children.
- getData() : array<string|int, mixed>|Data
- Returns all collected data.
- getName() : string
- {@inheritdoc}
- reset() : mixed
- cloneVar() : Data
- Converts the variable into a serializable Data instance.
- getCasters() : array<string|int, callable>
- recursiveBuildFinalFormTree() : mixed
- recursiveBuildPreliminaryFormTree() : mixed
Properties
$data
protected
array<string|int, mixed>|Data
$data
= []
$cloner
private
mixed
$cloner
$dataByForm
Stores the collected data per {@link FormInterface} instance.
private
array<string|int, mixed>
$dataByForm
Uses the hashes of the forms as keys. This is preferable over using , because in this way no references are kept to the instances.
$dataByView
Stores the collected data per {@link FormView} instance.
private
array<string|int, mixed>
$dataByView
Uses the hashes of the views as keys. This is preferable over using , because in this way no references are kept to the instances.
$dataExtractor
private
mixed
$dataExtractor
$formsByView
Connects {@link FormView} with {@link FormInterface} instances.
private
array<string|int, mixed>
$formsByView
Uses the hashes of the views as keys and the hashes of the forms as values. This is preferable over storing the objects directly, because this way they can safely be discarded by the GC.
Methods
__construct()
public
__construct(FormDataExtractorInterface $dataExtractor) : mixed
Parameters
- $dataExtractor : FormDataExtractorInterface
__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__wakeup()
public
__wakeup() : mixed
associateFormWithView()
Specifies that the given objects represent the same conceptual form.
public
associateFormWithView(FormInterface $form, FormView $view) : mixed
Parameters
- $form : FormInterface
- $view : FormView
buildFinalFormTree()
Assembles the data collected about the given form and its children as a tree-like data structure.
public
buildFinalFormTree(FormInterface $form, FormView $view) : mixed
Parameters
- $form : FormInterface
- $view : FormView
buildPreliminaryFormTree()
Assembles the data collected about the given form and its children as a tree-like data structure.
public
buildPreliminaryFormTree(FormInterface $form) : mixed
Parameters
- $form : FormInterface
collect()
Does nothing. The data is collected during the form event listeners.
public
collect(Request $request, Response $response[, Throwable $exception = null ]) : mixed
Parameters
collectConfiguration()
Stores configuration data of the given form and its children.
public
collectConfiguration(FormInterface $form) : mixed
Parameters
- $form : FormInterface
collectDefaultData()
Stores the default data of the given form and its children.
public
collectDefaultData(FormInterface $form) : mixed
Parameters
- $form : FormInterface
collectSubmittedData()
Stores the submitted data of the given form and its children.
public
collectSubmittedData(FormInterface $form) : mixed
Parameters
- $form : FormInterface
collectViewVariables()
Stores the view variables of the given form view and its children.
public
collectViewVariables(FormView $view) : mixed
Parameters
- $view : FormView
getData()
Returns all collected data.
public
getData() : array<string|int, mixed>|Data
Return values
array<string|int, mixed>|DatagetName()
{@inheritdoc}
public
getName() : string
Return values
stringreset()
public
reset() : mixed
cloneVar()
Converts the variable into a serializable Data instance.
protected
cloneVar(mixed $var) : Data
This array can be displayed in the template using the VarDumper component.
Parameters
- $var : mixed
Return values
DatagetCasters()
protected
getCasters() : array<string|int, callable>
Return values
array<string|int, callable> —The casters to add to the cloner
recursiveBuildFinalFormTree()
private
& recursiveBuildFinalFormTree([FormInterface $form = null ], FormView $view, array<string|int, mixed> &$outputByHash) : mixed
Parameters
- $form : FormInterface = null
- $view : FormView
- $outputByHash : array<string|int, mixed>
recursiveBuildPreliminaryFormTree()
private
& recursiveBuildPreliminaryFormTree(FormInterface $form, array<string|int, mixed> &$outputByHash) : mixed
Parameters
- $form : FormInterface
- $outputByHash : array<string|int, mixed>