Skip to content

Commit cab63ca

Browse files
committed
Documented that the Optional and Required constraints were moved to the Symfony\Component\Validator\Constraints\ namespace
1 parent ed05a78 commit cab63ca

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

reference/constraints/Collection.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ from the ``$personalData`` property, no validation error would occur.
166166
.. versionadded:: 2.1
167167
The ``Required`` and ``Optional`` constraints are new to Symfony 2.1.
168168

169+
.. versionadded:: 2.3
170+
The ``Required`` and ``Optional`` constraints were moved to the namespace
171+
``Symfony\Component\Validator\Constraints\`` in Symfony 2.3.
172+
169173
Required and Optional Field Constraints
170174
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
171175

@@ -191,8 +195,8 @@ field is optional but must be a valid email if supplied, you can do the followin
191195
/**
192196
* @Assert\Collection(
193197
* fields={
194-
* "personal_email" = @Assert\Collection\Required({@Assert\NotBlank, @Assert\Email}),
195-
* "alternate_email" = @Assert\Collection\Optional({@Assert\Email}),
198+
* "personal_email" = @Assert\Required({@Assert\NotBlank, @Assert\Email}),
199+
* "alternate_email" = @Assert\Optional(@Assert\Email),
196200
* }
197201
* )
198202
*/
@@ -217,8 +221,8 @@ field is optional but must be a valid email if supplied, you can do the followin
217221
{
218222
$metadata->addPropertyConstraint('profileData', new Assert\Collection(array(
219223
'fields' => array(
220-
'personal_email' => new Assert\Collection\Required(array(new Assert\NotBlank(), new Assert\Email())),
221-
'alternate_email' => new Assert\Collection\Optional(array(new Assert\Email())),
224+
'personal_email' => new Assert\Required(array(new Assert\NotBlank(), new Assert\Email())),
225+
'alternate_email' => new Assert\Optional(new Assert\Email()),
222226
),
223227
)));
224228
}

0 commit comments

Comments
 (0)