interface FormFactoryInterface

Allows creating a form based on a name, a class or a property.

Methods

create(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = [])

Returns a form.

createNamed(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = [])

Returns a form.

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

Returns a form for a property of a class.

createBuilder(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = [])

Returns a form builder.

createNamedBuilder(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = [])

Returns a form builder.

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

Returns a form builder for a property of a class.

Details

at line 34
FormInterface create(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = [])

Returns a form.

Parameters

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

Return Value

FormInterface The form named after the type

Exceptions

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

See also

createBuilder()

at line 50
FormInterface createNamed(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = [])

Returns a form.

Parameters

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

Return Value

FormInterface The form

Exceptions

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

See also

createNamedBuilder()

at line 66
FormInterface createForProperty(string $class, string $property, mixed $data = null, array $options = [])

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

FormInterface The form named after the property

Exceptions

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

See also

createBuilderForProperty()

at line 79
FormBuilderInterface createBuilder(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = [])

Returns a form builder.

Parameters

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

Return Value

FormBuilderInterface The form builder

Exceptions

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

at line 93
FormBuilderInterface createNamedBuilder(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = [])

Returns a form builder.

Parameters

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

Return Value

FormBuilderInterface The form builder

Exceptions

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

at line 110
FormBuilderInterface createBuilderForProperty(string $class, string $property, mixed $data = null, array $options = [])

Returns a form builder for a property of a class.

If any of the '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

FormBuilderInterface The form builder named after the property

Exceptions

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