Interface

Symfony\Component\Form\FormInterface

interface FormInterface implements ArrayAccess, Traversable, Countable

A form group bundling multiple form forms

Methods

setParent(FormInterface $parent = null)

Sets the parent form.

FormInterface getParent()

Returns the parent form.

Boolean hasParent()

Returns whether the form has a parent.

add(FormInterface $child)

Adds a child to the form.

Boolean has(string $name)

Returns whether a child with the given name exists.

remove(string $name)

Removes a child from the form.

array getChildren()

Returns all children in this group.

Boolean hasChildren()

Return whether the form has children.

array getErrors()

Returns all errors.

Form setData(array $appData)

Updates the field with default data.

mixed getData()

Returns the data in the format needed for the underlying object.

mixed getNormData()

Returns the normalized data of the field.

string getClientData()

Returns the data transformed by the value transformer.

array getExtraData()

Returns the extra data.

Boolean isBound()

Returns whether the field is bound.

array getTypes()

Returns the supported types.

string getName()

Returns the name by which the form is identified in forms.

addError(FormError $error)

Adds an error to this form.

Boolean isValid()

Returns whether the form is valid.

Boolean isRequired()

Returns whether the form is required to be filled out.

Boolean isReadOnly()

Returns whether this form can be read only.

Boolean isEmpty()

Returns whether the form is empty.

Boolean isSynchronized()

Returns whether the data in the different formats is synchronized.

bind(mixed $data)

Writes data into the form.

hasAttribute(string $name)

Returns whether the form has an attribute with the given name.

getAttribute(string $name)

Returns the value of the attributes with the given name.

FormInterface getRoot()

Returns the root of the form tree.

Boolean isRoot()

Returns whether the field is the root of the form tree.

FormView createView(FormView $parent = null)

Creates a view.

Details

at line 26
public setParent(FormInterface $parent = null)

Sets the parent form.

Parameters

FormInterface $parent The parent form

at line 33
public FormInterface getParent()

Returns the parent form.

Return Value

FormInterface The parent form

at line 40
public Boolean hasParent()

Returns whether the form has a parent.

Return Value

Boolean

at line 47
public add(FormInterface $child)

Adds a child to the form.

Parameters

FormInterface $child The FormInterface to add as a child

at line 56
public Boolean has(string $name)

Returns whether a child with the given name exists.

Parameters

string $name

Return Value

Boolean

at line 63
public remove(string $name)

Removes a child from the form.

Parameters

string $name The name of the child to remove

at line 70
public array getChildren()

Returns all children in this group.

Return Value

array An array of FormInterface instances

at line 77
public Boolean hasChildren()

Return whether the form has children.

Return Value

Boolean

at line 84
public array getErrors()

Returns all errors.

Return Value

array An array of FormError instances that occurred during binding

at line 93
public Form setData(array $appData)

Updates the field with default data.

Parameters

array $appData The data formatted as expected for the underlying object

Return Value

Form The current form

at line 100
public mixed getData()

Returns the data in the format needed for the underlying object.

Return Value

mixed

at line 109
public mixed getNormData()

Returns the normalized data of the field.

Return Value

mixed When the field is not bound, the default data is returned. When the field is bound, the normalized bound data is returned if the field is valid, null otherwise.

at line 116
public string getClientData()

Returns the data transformed by the value transformer.

Return Value

string

at line 123
public array getExtraData()

Returns the extra data.

Return Value

array The bound data which do not belong to a child

at line 130
public Boolean isBound()

Returns whether the field is bound.

Return Value

Boolean true if the form is bound to input values, false otherwise

at line 137
public array getTypes()

Returns the supported types.

Return Value

array An array of FormTypeInterface

at line 144
public string getName()

Returns the name by which the form is identified in forms.

Return Value

string The name of the form.

at line 151
public addError(FormError $error)

Adds an error to this form.

Parameters

FormError $error

at line 158
public Boolean isValid()

Returns whether the form is valid.

Return Value

Boolean

at line 169
public Boolean isRequired()

Returns whether the form is required to be filled out.

If the form has a parent and the parent is not required, this method will always return false. Otherwise the value set with setRequired() is returned.

Return Value

Boolean

at line 182
public Boolean isReadOnly()

Returns whether this form can be read only.

The content of a read-only form is displayed, but not allowed to be modified. The validation of modified read-only forms should fail.

Fields whose parents are read-only are considered read-only regardless of their own state.

Return Value

Boolean

at line 189
public Boolean isEmpty()

Returns whether the form is empty.

Return Value

Boolean

at line 196
public Boolean isSynchronized()

Returns whether the data in the different formats is synchronized.

Return Value

Boolean

at line 203
public bind(mixed $data)

Writes data into the form.

Parameters

mixed $data The data

at line 210
public hasAttribute(string $name)

Returns whether the form has an attribute with the given name.

Parameters

string $name The name of the attribute

at line 217
public getAttribute(string $name)

Returns the value of the attributes with the given name.

Parameters

string $name The name of the attribute

at line 224
public FormInterface getRoot()

Returns the root of the form tree.

Return Value

FormInterface The root of the tree

at line 231
public Boolean isRoot()

Returns whether the field is the root of the form tree.

Return Value

Boolean

at line 240
public FormView createView(FormView $parent = null)

Creates a view.

Parameters

FormView $parent The parent view

Return Value

FormView The view