Skip to content

Commit f027130

Browse files
Update without_class.rst
1 parent ccdeed2 commit f027130

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

form/without_class.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ but here's a short example::
9999
'constraints' => new Length(['min' => 3]),
100100
])
101101
->add('lastName', TextType::class, [
102-
'constraints' => [
102+
// the following configuration triggers an error `An error has occurred resolving the options of the form "Symfony\Component\Form\Extension\Core\Type\FormType": The option "constraints" with value array is expected to be of type "Symfony\Component\Validator\Constraint" or "Symfony\Component\Validator\Constraint[]", but one of the elements is of type "array".`
103+
'constraints' => [
103104
new NotBlank(),
104105
new Length(['min' => 3]),
105106
],
@@ -166,6 +167,9 @@ This can be done by setting the ``constraints`` option in the
166167
This means you can also do this when using the ``createFormBuilder()`` method
167168
in your controller::
168169

170+
// the following configuration triggers an error `An error has occurred resolving the options of the form "Symfony\Component\Form\Extension\Core\Type\FormType": The option "constraints" with value array is expected to be of type "Symfony\Component\Validator\Constraint" or "Symfony\Component\Validator\Constraint[]", but one of the elements is of type "array".`
171+
172+
169173
$form = $this->createFormBuilder($defaultData, [
170174
'constraints' => [
171175
'firstName' => new Length(['min' => 3]),

0 commit comments

Comments
 (0)