Properties

$formBuilder

$formBuilder : \Symfony\Component\Form\FormFactoryInterface

Type

\Symfony\Component\Form\FormFactoryInterface

$form

$form : \Symfony\Component\Form\Form

Type

\Symfony\Component\Form\Form

$request

$request

$view

$view

$has_error

$has_error : boolean

true if the form has an error, false otherwise.

Type

boolean

$error_message

$error_message : string

The form error message.

Type

string

Methods

getName()

getName() : string

Returns

string —

the name of you form. This name must be unique

__construct()

__construct(\Symfony\Component\HttpFoundation\Request $request,  $type,  $data,  $options)

Parameters

\Symfony\Component\HttpFoundation\Request $request
$type
$data
$options

getRequest()

getRequest()

getSuccessUrl()

getSuccessUrl(string $default) : string

Returns the absolute URL to redirect the user to if the form is successfully processed.

Parameters

string $default

the default URL. If not given, the configured base URL is used.

Returns

string —

an absolute URL

createView()

createView()

getView()

getView()

setError()

setError(boolean $has_error)

Set the error status of the form.

Parameters

boolean $has_error

hasError()

hasError() : boolean

Get the cuirrent error status of the form.

Returns

boolean

setErrorMessage()

setErrorMessage(\Thelia\Form\unknown $message)

Set the error message related to global form error

Parameters

\Thelia\Form\unknown $message

getErrorMessage()

getErrorMessage() : string

Get the form error message.

Returns

string

getForm()

getForm() : \Symfony\Component\Form\Form

Returns

\Symfony\Component\Form\Form

buildForm()

buildForm() : null

in this function you add all the fields you need for your Form.

Form this you have to call add method on $this->formBuilder attribute :

$this->formBuilder->add("name", "text") ->add("email", "email", array( "attr" => array( "class" => "field" ), "label" => "email", "constraints" => array( new \Symfony\Component\Validator\Constraints\NotBlank() ) ) ) ->add('age', 'integer');

Returns

null

cleanOptions()

cleanOptions( $options)

Parameters

$options