Introduced automatic form fields binding

This commit is contained in:
Franck Allimant
2014-06-26 10:42:16 +02:00
parent ce3ed19b67
commit 0b3de508b4

View File

@@ -25,35 +25,20 @@ class SeoForm extends BaseForm
use SeoFieldsTrait;
/**
*
* 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');
*
* @return null
* @inheritdoc
*/
protected function buildForm()
{
$this->formBuilder
->add("id", "hidden", array(
'required' => true,
"constraints" => array(
new GreaterThan(array('value' => 0))
)
))
->add("locale", "hidden", array(
'required' => true,
"constraints" => array(
new NotBlank()
)