PHP Interface Symfony\Component\Form\FieldInterface

Author: Bernhard Schussek ([email protected])
Inheritance: extends Symfony\Component\Form\Localizable
Show file Open project: pmjones/php-framework-benchmarks Interface Usage Examples

Public Methods

Method Description
__clone ( ) Clones this field.
addError ( Symfony\Component\Form\FieldError $error, Symfony\Component\Form\PropertyPathIterator $pathIterator = null, $type = null ) Recursively adds constraint violations to the fields
bind ( string | array $taintedData ) : boolean Binds POST data to the field, transforms and validates it.
getData ( ) : mixed Returns the normalized data of the field.
getDisplayedData ( ) : string | array Returns the data of the field as it is displayed to the user.
getId ( ) : string Returns the ID of the field.
getKey ( ) : string Returns the key by which the field is identified in field groups.
getName ( ) : string Returns the name of the field.
getParent ( ) : Symfony\Component\Form\FieldInterface Returns the parent field.
getPropertyPath ( ) : PropertyPath Returns the property path of the field
isBound ( ) : boolean Returns whether the field is bound.
isDisabled ( ) : boolean Returns whether this field is disabled
isHidden ( ) : boolean Returns whether the field is hidden
isMultipart ( ) : boolean Returns whether the field requires a multipart form.
isRequired ( ) : boolean Returns whether the field is required to be filled out.
isValid ( ) : boolean Returns whether the field is valid.
setData ( mixed $default ) Sets the default data
setKey ( string $key ) Sets the key by which the field is identified in field groups.
setParent ( Symfony\Component\Form\FieldInterface $parent = null ) Sets the parent field.
setPropertyPath ( string $propertyPath ) Sets the property path
setRequired ( boolean $required ) Sets whether this field is required to be filled out when submitted.
updateFromObject ( array | object &$objectOrArray ) Writes a property value of the object into the field
updateObject ( array | object &$objectOrArray ) Writes a the field value into a property of the object

Method Details

__clone() public method

Clones this field.
public __clone ( )

addError() public method

Violations in the form fields usually have property paths like: iterator[firstName].data iterator[firstName].displayedData iterator[Address].iterator[street].displayedData ... Violations in the form data usually have property paths like: data.firstName data.Address.street ...
public addError ( Symfony\Component\Form\FieldError $error, Symfony\Component\Form\PropertyPathIterator $pathIterator = null, $type = null )
$error Symfony\Component\Form\FieldError
$pathIterator Symfony\Component\Form\PropertyPathIterator

bind() public method

Binds POST data to the field, transforms and validates it.
public bind ( string | array $taintedData ) : boolean
$taintedData string | array The POST data
return boolean Whether the form is valid

getData() public method

Returns the normalized data of the field.
public getData ( ) : mixed
return 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.

getDisplayedData() public method

Returns the data of the field as it is displayed to the user.
public getDisplayedData ( ) : string | array
return string | array When the field is not bound, the transformed default data is returned. When the field is bound, the bound data is returned.

getId() public method

Returns the ID of the field.
public getId ( ) : string
return string The ID of a field is equal to its name, where all sequences of squared brackets are replaced by a single underscore (e.g. if the name is "parent_name[field_key]", the ID is "parent_name_field_key").

getKey() public method

Returns the key by which the field is identified in field groups.
public getKey ( ) : string
return string The key of the field.

getName() public method

Returns the name of the field.
public getName ( ) : string
return string When the field has no parent, the name is equal to its key. If the field has a parent, the name is composed of the parent's name and the field's key, where the field's key is wrapped in squared brackets (e.g. "parent_name[field_key]")

getParent() public method

Returns the parent field.
public getParent ( ) : Symfony\Component\Form\FieldInterface
return Symfony\Component\Form\FieldInterface The parent field

getPropertyPath() public method

Returns the property path of the field
public getPropertyPath ( ) : PropertyPath
return PropertyPath

isBound() public method

Returns whether the field is bound.
public isBound ( ) : boolean
return boolean

isDisabled() public method

The content of a disabled field is displayed, but not allowed to be modified. The validation of modified, disabled fields should fail. Fields whose parents are disabled are considered disabled regardless of their own state.
public isDisabled ( ) : boolean
return boolean

isHidden() public method

Returns whether the field is hidden
public isHidden ( ) : boolean
return boolean

isMultipart() public method

Returns whether the field requires a multipart form.
public isMultipart ( ) : boolean
return boolean

isRequired() public method

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

isValid() public method

Returns whether the field is valid.
public isValid ( ) : boolean
return boolean

setData() public method

Sets the default data
public setData ( mixed $default )
$default mixed The default data

setKey() public method

Once this field is nested in a field group, i.e. after setParent() was called for the first time, this method should throw an exception.
public setKey ( string $key )
$key string The key of the field

setParent() public method

Sets the parent field.
public setParent ( Symfony\Component\Form\FieldInterface $parent = null )
$parent Symfony\Component\Form\FieldInterface The parent field

setPropertyPath() public method

The property path determines the property or a sequence of properties that a field updates in the data of the field group.
public setPropertyPath ( string $propertyPath )
$propertyPath string

setRequired() public method

Sets whether this field is required to be filled out when submitted.
public setRequired ( boolean $required )
$required boolean

updateFromObject() public method

The chosen property is determined by the field's property path.
public updateFromObject ( array | object &$objectOrArray )
$objectOrArray array | object

updateObject() public method

The chosen property is determined by the field's property path.
public updateObject ( array | object &$objectOrArray )
$objectOrArray array | object