Interface

Symfony\Component\Form\FormFactoryInterface

interface FormFactoryInterface

Methods

Form create(string|FormTypeInterface $type, mixed $data = null, array $options = array())

Returns a form.

Form createNamed(string|FormTypeInterface $type, string $name, mixed $data = null, array $options = array())

Returns a form.

Form createForProperty(string $class, string $property, mixed $data = null, array $options = array())

Returns a form for a property of a class.

FormBuilder createBuilder(string|FormTypeInterface $type, mixed $data = null, array $options = array())

Returns a form builder

FormBuilder createNamedBuilder(string|FormTypeInterface $type, string $name, mixed $data = null, array $options = array())

Returns a form builder.

FormBuilder createBuilderForProperty(string $class, string $property, mixed $data = null, array $options = array())

Returns a form builder for a property of a class.

getType($name)

hasType($name)

addType(FormTypeInterface $type)

Details

at line 29
public Form create(string|FormTypeInterface $type, mixed $data = null, array $options = array())

Returns a form.

Parameters

string|FormTypeInterface $type The type of the form
mixed $data The initial data
array $options The options

Return Value

Form The form named after the type

Exceptions

FormException if any given option is not applicable to the given type

See also

createBuilder()

at line 43
public Form createNamed(string|FormTypeInterface $type, string $name, mixed $data = null, array $options = array())

Returns a form.

Parameters

string|FormTypeInterface $type The type of the form
string $name The name of the form
mixed $data The initial data
array $options The options

Return Value

Form The form

Exceptions

FormException if any given option is not applicable to the given type

at line 57
public Form createForProperty(string $class, string $property, mixed $data = null, array $options = array())

Returns a form for a property of a class.

Parameters

string $class The fully qualified class name
string $property The name of the property to guess for
mixed $data The initial data
array $options The options for the builder

Return Value

Form The form named after the property

Exceptions

FormException if any given option is not applicable to the form type

at line 70
public FormBuilder createBuilder(string|FormTypeInterface $type, mixed $data = null, array $options = array())

Returns a form builder

Parameters

string|FormTypeInterface $type The type of the form
mixed $data The initial data
array $options The options

Return Value

FormBuilder The form builder

Exceptions

FormException if any given option is not applicable to the given type

at line 84
public FormBuilder createNamedBuilder(string|FormTypeInterface $type, string $name, mixed $data = null, array $options = array())

Returns a form builder.

Parameters

string|FormTypeInterface $type The type of the form
string $name The name of the form
mixed $data The initial data
array $options The options

Return Value

FormBuilder The form builder

Exceptions

FormException if any given option is not applicable to the given type

at line 101
public FormBuilder createBuilderForProperty(string $class, string $property, mixed $data = null, array $options = array())

Returns a form builder for a property of a class.

If any of the 'max_length', 'required' and type options can be guessed, and are not provided in the options argument, the guessed value is used.

Parameters

string $class The fully qualified class name
string $property The name of the property to guess for
mixed $data The initial data
array $options The options for the builder

Return Value

FormBuilder The form builder named after the property

Exceptions

FormException if any given option is not applicable to the form type

at line 103
public getType($name)

Parameters

$name

at line 105
public hasType($name)

Parameters

$name

at line 107
public addType(FormTypeInterface $type)

Parameters

FormTypeInterface $type