File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ This can be done by setting the ``constraints`` option in the
137
137
use Symfony\Component\Form\Extension\Core\Type\TextType;
138
138
use Symfony\Component\Form\FormBuilderInterface;
139
139
use Symfony\Component\OptionsResolver\OptionsResolver;
140
+ use Symfony\Component\Validator\Constraints\Collection;
140
141
use Symfony\Component\Validator\Constraints\Length;
141
142
use Symfony\Component\Validator\Constraints\NotBlank;
142
143
@@ -149,17 +150,15 @@ This can be done by setting the ``constraints`` option in the
149
150
150
151
public function configureOptions(OptionsResolver $resolver): void
151
152
{
152
- $constraints = [
153
- 'firstName' => new Length(['min' => 3]),
154
- 'lastName' => [
155
- new NotBlank(),
156
- new Length(['min' => 3]),
157
- ],
158
- ];
159
-
160
153
$resolver->setDefaults([
161
154
'data_class' => null,
162
- 'constraints' => $constraints,
155
+ 'constraints' => new Collection([
156
+ 'firstName' => new Length(['min' => 3]),
157
+ 'lastName' => [
158
+ new NotBlank(),
159
+ new Length(['min' => 3]),
160
+ ],
161
+ ]),
163
162
]);
164
163
}
165
164
You can’t perform that action at this time.
0 commit comments