PHP Интерфейс Symfony\Component\Form\FieldInterface

Автор: Bernhard Schussek ([email protected])
Наследование: extends Symfony\Component\Form\Localizable
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
__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

Описание методов

__clone() публичный Метод

Clones this field.
public __clone ( )

addError() публичный Метод

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() публичный Метод

Binds POST data to the field, transforms and validates it.
public bind ( string | array $taintedData ) : boolean
$taintedData string | array The POST data
Результат boolean Whether the form is valid

getData() публичный Метод

Returns the normalized data of the field.
public getData ( ) : mixed
Результат 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() публичный Метод

Returns the data of the field as it is displayed to the user.
public getDisplayedData ( ) : string | array
Результат 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() публичный Метод

Returns the ID of the field.
public getId ( ) : string
Результат 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() публичный Метод

Returns the key by which the field is identified in field groups.
public getKey ( ) : string
Результат string The key of the field.

getName() публичный Метод

Returns the name of the field.
public getName ( ) : string
Результат 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() публичный Метод

Returns the parent field.
public getParent ( ) : Symfony\Component\Form\FieldInterface
Результат Symfony\Component\Form\FieldInterface The parent field

getPropertyPath() публичный Метод

Returns the property path of the field
public getPropertyPath ( ) : PropertyPath
Результат PropertyPath

isBound() публичный Метод

Returns whether the field is bound.
public isBound ( ) : boolean
Результат boolean

isDisabled() публичный Метод

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
Результат boolean

isHidden() публичный Метод

Returns whether the field is hidden
public isHidden ( ) : boolean
Результат boolean

isMultipart() публичный Метод

Returns whether the field requires a multipart form.
public isMultipart ( ) : boolean
Результат boolean

isRequired() публичный Метод

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
Результат boolean

isValid() публичный Метод

Returns whether the field is valid.
public isValid ( ) : boolean
Результат boolean

setData() публичный Метод

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

setKey() публичный Метод

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() публичный Метод

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

setPropertyPath() публичный Метод

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() публичный Метод

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

updateFromObject() публичный Метод

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

updateObject() публичный Метод

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