@@ -455,27 +455,33 @@ If you're ever unsure of how to specify an option, either check the API document
455455for the constraint or play it safe by always passing in an array of options
456456(the first method shown above).
457457
458- ..index ::
459- single: Validation; Constraint targets
460-
461- .. _validator-constraint-targets :
462-
463- Constraint in Form Classes
464- ------------------
458+ Constraints in Form Classes
459+ ---------------------------
465460
466- When creating your own form classes, you may want to add constraint directly in theformBuilder.
467- This is done by simply adding them as a parameter in your field options ::
461+ Constraints can be defined while building the form via the`` constraints `` option
462+ of the form fields ::
468463
469464 public function buildForm(FormBuilderInterface $builder, array $options)
470465 {
471466 $builder
472- ->add('myField', TextType::class, ['required' => true, 'constraints' => [new Length(['min' => 3])]])
467+ ->add('myField', TextType::class, array(
468+ 'required' => true,
469+ 'constraints' => array(new Length(array('min' => 3)))
470+ ))
473471 }
474472
475- Please note the * constraints * keyword will onlybe availableif you have
476- added the * ValidatorExtention * to the formBuilder::
473+ The `` constraints `` option is only availablewhen adding the ValidatorExtention
474+ to the formBuilder::
477475
478- Forms::createFormFactoryBuilder()->addExtension(new ValidatorExtension(Validation::createValidator()))->getFormFactory();
476+ Forms::createFormFactoryBuilder()
477+ ->addExtension(new ValidatorExtension(Validation::createValidator()))
478+ ->getFormFactory()
479+ ;
480+
481+ ..index ::
482+ single: Validation; Constraint targets
483+
484+ .. _validator-constraint-targets :
479485
480486Constraint Targets
481487------------------