PHP 클래스 Symfony\Component\Form\FieldGroup

저자: Fabien Potencier ([email protected])
상속: extends Field, implements IteratorAggregate, implements Symfony\Component\Form\FieldGroupInterface
파일 보기 프로젝트 열기: pmjones/php-framework-benchmarks 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$extraFields array Contains the names of bound values who don't belong to any fields
$fields array Contains all the fields of this group

공개 메소드들

메소드 설명
__clone ( ) Clones this group
add ( Symfony\Component\Form\FieldInterface $field ) Adds a new field to this group. A field must have a unique name within the group. Otherwise the existing field is overwritten.
addError ( Symfony\Component\Form\FieldError $error, Symfony\Component\Form\PropertyPathIterator $pathIterator = null, $type = null ) {@inheritDoc}
bind ( string | array $taintedData ) : boolean Binds POST data to the field, transforms and validates it.
count ( ) : integer Returns the number of form fields (implements the \Countable interface).
get ( string $key ) : Symfony\Component\Form\FieldInterface Returns the field with the given key.
getAllHiddenFields ( ) : array Returns an array of hidden fields from the current schema.
getAllVisibleFields ( ) : array Returns an array of visible fields from the current schema.
getDisplayedData ( ) Returns the data of the field as it is displayed to the user.
getFields ( ) : array Returns all fields in this group
getHiddenFields ( ) : array Returns an array of hidden fields from the current schema.
getIterator ( ) : ArrayIterator Returns the iterator for this group.
getVisibleFields ( ) : array Returns an array of visible fields from the current schema.
has ( string $key ) : boolean Returns whether a field with the given key exists.
isBoundWithExtraFields ( ) : boolean Returns whether this form was bound with extra fields
isMultipart ( ) : boolean Returns whether the field requires a multipart form.
isValid ( ) : boolean Returns whether the field is valid.
merge ( FieldGroup $group ) Merges a field group into this group. The group must have a unique name within the group. Otherwise the existing field is overwritten.
offsetExists ( string $key ) : boolean Returns true if the bound field exists (implements the \ArrayAccess interface).
offsetGet ( string $key ) : Field Returns the form field associated with the name (implements the \ArrayAccess interface).
offsetSet ( $key, $field ) Throws an exception saying that values cannot be set (implements the \ArrayAccess interface).
offsetUnset ( string $key ) Throws an exception saying that values cannot be unset (implements the \ArrayAccess interface).
remove ( string $key ) Removes the field with the given key.
setData ( $data ) Initializes the field group with an object to operate on
setLocale ( $locale ) Sets the locale of this field.

보호된 메소드들

메소드 설명
getFieldsByVisibility ( boolean $hidden, boolean $recursive ) : array Returns a filtered array of fields from the current schema.
preprocessData ( array $data ) : array Processes the bound data before it is passed to the individual fields

메소드 상세

__clone() 공개 메소드

Clones this group
public __clone ( )

add() 공개 메소드

If you add a nested group, this group should also be represented in the object hierarchy. If you want to add a group that operates on the same hierarchy level, use merge(). class Entity { public $location; } class Location { public $longitude; public $latitude; } $entity = new Entity(); $entity->location = new Location(); $form = new Form('entity', $entity, $validator); $locationGroup = new FieldGroup('location'); $locationGroup->add(new TextField('longitude')); $locationGroup->add(new TextField('latitude')); $form->add($locationGroup);
public add ( Symfony\Component\Form\FieldInterface $field )
$field Symfony\Component\Form\FieldInterface

addError() 공개 메소드

{@inheritDoc}
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

count() 공개 메소드

Returns the number of form fields (implements the \Countable interface).
public count ( ) : integer
리턴 integer The number of embedded form fields

get() 공개 메소드

Returns the field with the given key.
public get ( string $key ) : Symfony\Component\Form\FieldInterface
$key string
리턴 Symfony\Component\Form\FieldInterface

getAllHiddenFields() 공개 메소드

This variant of the method will recursively get all the fields from the nested forms or field groups
public getAllHiddenFields ( ) : array
리턴 array

getAllVisibleFields() 공개 메소드

This variant of the method will recursively get all the fields from the nested forms or field groups
public getAllVisibleFields ( ) : array
리턴 array

getDisplayedData() 공개 메소드

Returns the data of the field as it is displayed to the user.
또한 보기: FieldInterface
public getDisplayedData ( )

getFields() 공개 메소드

Returns all fields in this group
public getFields ( ) : array
리턴 array

getFieldsByVisibility() 보호된 메소드

Returns a filtered array of fields from the current schema.
protected getFieldsByVisibility ( boolean $hidden, boolean $recursive ) : array
$hidden boolean Whether to return hidden fields only or visible fields only
$recursive boolean Whether to recur through embedded schemas
리턴 array

getHiddenFields() 공개 메소드

Returns an array of hidden fields from the current schema.
public getHiddenFields ( ) : array
리턴 array

getIterator() 공개 메소드

Returns the iterator for this group.

getVisibleFields() 공개 메소드

Returns an array of visible fields from the current schema.
public getVisibleFields ( ) : array
리턴 array

has() 공개 메소드

Returns whether a field with the given key exists.
public has ( string $key ) : boolean
$key string
리턴 boolean

isBoundWithExtraFields() 공개 메소드

Returns whether this form was bound with extra fields
public isBoundWithExtraFields ( ) : boolean
리턴 boolean

isMultipart() 공개 메소드

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

isValid() 공개 메소드

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

merge() 공개 메소드

Contrary to added groups, merged groups operate on the same object as the group they are merged into. class Entity { public $longitude; public $latitude; } $entity = new Entity(); $form = new Form('entity', $entity, $validator); $locationGroup = new FieldGroup('location'); $locationGroup->add(new TextField('longitude')); $locationGroup->add(new TextField('latitude')); $form->merge($locationGroup);
public merge ( FieldGroup $group )
$group FieldGroup

offsetExists() 공개 메소드

Returns true if the bound field exists (implements the \ArrayAccess interface).
public offsetExists ( string $key ) : boolean
$key string The key of the bound field
리턴 boolean true if the widget exists, false otherwise

offsetGet() 공개 메소드

Returns the form field associated with the name (implements the \ArrayAccess interface).
public offsetGet ( string $key ) : Field
$key string The offset of the value to get
리턴 Field A form field instance

offsetSet() 공개 메소드

Throws an exception saying that values cannot be set (implements the \ArrayAccess interface).
public offsetSet ( $key, $field )

offsetUnset() 공개 메소드

Throws an exception saying that values cannot be unset (implements the \ArrayAccess interface).
public offsetUnset ( string $key )
$key string

preprocessData() 보호된 메소드

The data is in the user format.
protected preprocessData ( array $data ) : array
$data array
리턴 array

remove() 공개 메소드

Removes the field with the given key.
public remove ( string $key )
$key string

setData() 공개 메소드

Initializes the field group with an object to operate on
또한 보기: FieldInterface
public setData ( $data )

setLocale() 공개 메소드

Sets the locale of this field.
또한 보기: Localizable
public setLocale ( $locale )

프로퍼티 상세

$extraFields 보호되어 있는 프로퍼티

Contains the names of bound values who don't belong to any fields
protected array $extraFields
리턴 array

$fields 보호되어 있는 프로퍼티

Contains all the fields of this group
protected array $fields
리턴 array