FormFactory
class FormFactory implements FormFactoryInterface
Methods
| __construct(FormRegistryInterface $registry) | |
FormInterface | create(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. | |
FormInterface | createNamed(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. | |
FormInterface | createForProperty(string $class, string $property, mixed $data = null, array $options = array()) Returns a form for a property of a class. | |
FormBuilderInterface | createBuilder(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. | |
FormBuilderInterface | createNamedBuilder(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. | |
FormBuilderInterface | createBuilderForProperty(string $class, string $property, mixed $data = null, array $options = array()) Returns a form builder for a property of a class. | |
Details
Parameters
FormInterface
create(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array())
Returns a form.
Parameters
string | $type | The type of the form |
mixed | $data | The initial data |
array | $options | The options |
Return Value
Exceptions
FormInterface
createNamed(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array())
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
Exceptions
FormInterface
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
Exceptions
FormBuilderInterface
createBuilder(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array())
Returns a form builder.
Parameters
string | $type | The type of the form |
mixed | $data | The initial data |
array | $options | The options |
Return Value
Exceptions
FormBuilderInterface
createNamedBuilder(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array())
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
Exceptions
FormBuilderInterface
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 '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
Exceptions