PHP 클래스 Symfony\Component\Form\Form

A form is composed of a validator schema and a widget form schema. Form also takes care of CSRF protection by default. A CSRF secret can be any random string. If set to false, it disables the CSRF protection, and if set to null, it forces the form to use the global CSRF secret. If the global CSRF secret is also null, then a random one is generated on the fly.
저자: Fabien Potencier ([email protected])
저자: Bernhard Schussek ([email protected])
상속: extends Field, implements IteratorAggregate, implements Symfony\Component\Form\FormInterface
파일 보기 프로젝트 열기: pmjones/php-framework-benchmarks 1 사용 예제들

공개 메소드들

메소드 설명
__clone ( )
__construct ( $name, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, array $types = [], array $clientTransformers = [], array $normTransformers = [], Symfony\Component\Form\DataMapperInterface $dataMapper = null, array $validators = [], $required = false, $readOnly = false, $errorBubbling = false, $emptyData = null, array $attributes = [] )
add ( Symfony\Component\Form\FormInterface $child ) : Form Adds a child to the form.
addError ( FormError $error ) : Form Adds an error to this form.
bind ( string | array $clientData ) : Form Binds data to the field, transforms and validates it.
bindRequest ( Request $request ) : Form Binds a request to the form.
count ( ) : integer Returns the number of form children (implements the \Countable interface).
createView ( Symfony\Component\Form\FormView $parent = null ) : Symfony\Component\Form\FormView Creates a view.
get ( string $name ) : Symfony\Component\Form\FormInterface Returns the child with the given name.
getAttribute ( string $name ) Returns the value of the attributes with the given name.
getChildren ( ) : array Returns all children in this group.
getClientData ( ) : string Returns the data transformed by the value transformer.
getClientTransformers ( ) : array Returns the DataTransformers.
getData ( ) : mixed Returns the data in the format needed for the underlying object.
getErrorBubbling ( ) : boolean Returns whether errors bubble up to the parent.
getErrors ( ) : array Returns all errors.
getExtraData ( ) : array Returns the extra data.
getIterator ( ) : ArrayIterator Returns the iterator for this group.
getName ( ) : string Returns the name by which the form is identified in forms.
getNormData ( ) : mixed Returns the normalized data of the field.
getNormTransformers ( ) : array Returns the DataTransformers.
getParent ( ) : Symfony\Component\Form\FormInterface Returns the parent field.
getRoot ( ) : Symfony\Component\Form\FormInterface Returns the root of the form tree.
getTypes ( ) : array Returns the types used by this form.
has ( string $name ) : boolean Returns whether a child with the given name exists.
hasAttribute ( string $name ) Returns whether the form has an attribute with the given name.
hasChildren ( ) : boolean Return whether the form has children.
hasErrors ( ) : boolean Returns whether or not there are errors.
hasParent ( ) : boolean Returns whether the form has a parent.
isBound ( ) : boolean Returns whether the field is bound.
isEmpty ( ) : boolean Returns whether the form is empty.
isReadOnly ( ) : boolean Returns whether this form is read only.
isRequired ( ) : boolean Returns whether the form is required to be filled out.
isRoot ( ) : boolean Returns whether the field is the root of the form tree.
isSynchronized ( ) : boolean Returns whether the data in the different formats is synchronized.
isValid ( ) : boolean Returns whether the field is valid.
offsetExists ( string $name ) : boolean Returns true if the child exists (implements the \ArrayAccess interface).
offsetGet ( string $name ) : Symfony\Component\Form\FormInterface Returns the form child associated with the name (implements the \ArrayAccess interface).
offsetSet ( string $name, Symfony\Component\Form\FormInterface $child ) Adds a child to the form (implements the \ArrayAccess interface).
offsetUnset ( string $name ) Removes the child with the given name from the form (implements the \ArrayAccess interface).
remove ( string $name ) : Form Removes a child from the form.
setData ( array $appData ) : Form Updates the field with default data.
setParent ( Symfony\Component\Form\FormInterface $parent = null ) : Form Sets the parent form.

비공개 메소드들

메소드 설명
appToNorm ( mixed $value ) : string Normalizes the value if a normalization transformer is set.
clientToNorm ( string $value ) : mixed Reverse transforms a value if a value transformer is set.
normToApp ( string $value ) : mixed Reverse transforms a value if a normalization transformer is set.
normToClient ( mixed $value ) : string Transforms the value if a value transformer is set.

메소드 상세

__clone() 공개 메소드

public __clone ( )

__construct() 공개 메소드

public __construct ( $name, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, array $types = [], array $clientTransformers = [], array $normTransformers = [], Symfony\Component\Form\DataMapperInterface $dataMapper = null, array $validators = [], $required = false, $readOnly = false, $errorBubbling = false, $emptyData = null, array $attributes = [] )
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$types array
$clientTransformers array
$normTransformers array
$dataMapper Symfony\Component\Form\DataMapperInterface
$validators array
$attributes array

add() 공개 메소드

Adds a child to the form.
public add ( Symfony\Component\Form\FormInterface $child ) : Form
$child Symfony\Component\Form\FormInterface The FormInterface to add as a child
리턴 Form the current form

addError() 공개 메소드

Adds an error to this form.
public addError ( FormError $error ) : Form
$error FormError
리턴 Form The current form

bind() 공개 메소드

Binds data to the field, transforms and validates it.
public bind ( string | array $clientData ) : Form
$clientData string | array The data
리턴 Form The current form

bindRequest() 공개 메소드

If the request method is POST, PUT or GET, the data is bound to the form, transformed and written into the form data (an object or an array).
public bindRequest ( Request $request ) : Form
$request Symfony\Component\HttpFoundation\Request The request to bind to the form
리턴 Form This form

count() 공개 메소드

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

createView() 공개 메소드

Creates a view.
public createView ( Symfony\Component\Form\FormView $parent = null ) : Symfony\Component\Form\FormView
$parent Symfony\Component\Form\FormView The parent view
리턴 Symfony\Component\Form\FormView The view

get() 공개 메소드

Returns the child with the given name.
public get ( string $name ) : Symfony\Component\Form\FormInterface
$name string
리턴 Symfony\Component\Form\FormInterface

getAttribute() 공개 메소드

Returns the value of the attributes with the given name.
public getAttribute ( string $name )
$name string The name of the attribute

getChildren() 공개 메소드

Returns all children in this group.
public getChildren ( ) : array
리턴 array

getClientData() 공개 메소드

Returns the data transformed by the value transformer.
public getClientData ( ) : string
리턴 string

getClientTransformers() 공개 메소드

Returns the DataTransformers.
public getClientTransformers ( ) : array
리턴 array An array of DataTransformerInterface

getData() 공개 메소드

Returns the data in the format needed for the underlying object.
public getData ( ) : mixed
리턴 mixed

getErrorBubbling() 공개 메소드

Returns whether errors bubble up to the parent.
public getErrorBubbling ( ) : boolean
리턴 boolean

getErrors() 공개 메소드

Returns all errors.
public getErrors ( ) : array
리턴 array An array of FormError instances that occurred during binding

getExtraData() 공개 메소드

Returns the extra data.
public getExtraData ( ) : array
리턴 array The bound data which do not belong to a child

getIterator() 공개 메소드

Returns the iterator for this group.

getName() 공개 메소드

Returns the name by which the form is identified in forms.
public getName ( ) : string
리턴 string The name of the form.

getNormData() 공개 메소드

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

getNormTransformers() 공개 메소드

Returns the DataTransformers.
public getNormTransformers ( ) : array
리턴 array An array of DataTransformerInterface

getParent() 공개 메소드

Returns the parent field.
public getParent ( ) : Symfony\Component\Form\FormInterface
리턴 Symfony\Component\Form\FormInterface The parent field

getRoot() 공개 메소드

Returns the root of the form tree.
public getRoot ( ) : Symfony\Component\Form\FormInterface
리턴 Symfony\Component\Form\FormInterface The root of the tree

getTypes() 공개 메소드

Returns the types used by this form.
public getTypes ( ) : array
리턴 array An array of FormTypeInterface

has() 공개 메소드

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

hasAttribute() 공개 메소드

Returns whether the form has an attribute with the given name.
public hasAttribute ( string $name )
$name string The name of the attribute

hasChildren() 공개 메소드

Return whether the form has children.
public hasChildren ( ) : boolean
리턴 boolean

hasErrors() 공개 메소드

Returns whether or not there are errors.
public hasErrors ( ) : boolean
리턴 boolean true if form is bound and not valid

hasParent() 공개 메소드

Returns whether the form has a parent.
public hasParent ( ) : boolean
리턴 boolean

isBound() 공개 메소드

Returns whether the field is bound.
public isBound ( ) : boolean
리턴 boolean true if the form is bound to input values, false otherwise

isEmpty() 공개 메소드

Returns whether the form is empty.
public isEmpty ( ) : boolean
리턴 boolean

isReadOnly() 공개 메소드

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.
public isReadOnly ( ) : boolean
리턴 boolean

isRequired() 공개 메소드

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.
public isRequired ( ) : boolean
리턴 boolean

isRoot() 공개 메소드

Returns whether the field is the root of the form tree.
public isRoot ( ) : boolean
리턴 boolean

isSynchronized() 공개 메소드

Returns whether the data in the different formats is synchronized.
public isSynchronized ( ) : boolean
리턴 boolean

isValid() 공개 메소드

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

offsetExists() 공개 메소드

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

offsetGet() 공개 메소드

Returns the form child associated with the name (implements the \ArrayAccess interface).
public offsetGet ( string $name ) : Symfony\Component\Form\FormInterface
$name string The offset of the value to get
리턴 Symfony\Component\Form\FormInterface A form instance

offsetSet() 공개 메소드

Adds a child to the form (implements the \ArrayAccess interface).
public offsetSet ( string $name, Symfony\Component\Form\FormInterface $child )
$name string Ignored. The name of the child is used.
$child Symfony\Component\Form\FormInterface The child to be added

offsetUnset() 공개 메소드

Removes the child with the given name from the form (implements the \ArrayAccess interface).
public offsetUnset ( string $name )
$name string The name of the child to be removed

remove() 공개 메소드

Removes a child from the form.
public remove ( string $name ) : Form
$name string The name of the child to remove
리턴 Form the current form

setData() 공개 메소드

Updates the field with default data.
public setData ( array $appData ) : Form
$appData array The data formatted as expected for the underlying object
리턴 Form The current form

setParent() 공개 메소드

Sets the parent form.
public setParent ( Symfony\Component\Form\FormInterface $parent = null ) : Form
$parent Symfony\Component\Form\FormInterface The parent form
리턴 Form The current form