8000 removed deprecated examples from doc · meistro2k/symfony@7734fdf · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 7734fdf

Browse files
author
Andreas Hucks
committed
removed deprecated examples from doc
1 parent 3a14734 commit 7734fdf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Symfony/Component/Validator/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ containing the rules for the validation. Let's validate a simple string
8000
1313
as an example:
1414

1515
use Symfony\Component\Validator\Validation;
16-
use Symfony\Component\Validator\Constraints\MinLength;
16+
use Symfony\Component\Validator\Constraints\Length;
1717

1818
$validator = Validation::createValidator();
1919

20-
$violations = $validator->validateValue('Bernhard', new MinLength(10));
20+
$violations = $validator->validateValue('Bernhard', new Length(array('min' => 10)));
2121

2222
This validation will fail because the given string is shorter than ten
2323
characters. The precise errors, here called "constraint violations", are
@@ -33,14 +33,14 @@ Validation of arrays is possible using the `Collection` constraint:
3333

3434
$constraint = new Assert\Collection(array(
3535
'name' => new Assert\Collection(array(
36-
'first_name' => new Assert\MinLength(101),
37-
'last_name' => new Assert\MinLength(1),
36+
'first_name' => new Assert\Length(array('min' => 101)),
37+
'last_name' => new Assert\Length(array('min' => 1)),
3838
)),
3939
'email' => new Assert\Email(),
40-
'simple' => new Assert\MinLength(102),
40+
'simple' => new Assert\Length(array('min' => 102)),
4141
'gender' => new Assert\Choice(array(3, 4)),
4242
'file' => new Assert\File(),
43-
'password' => new Assert\MinLength(60),
43+
'password' => new Assert\Length(array('min' => 60)),
4444
));
4545

4646
$violations = $validator->validateValue($input, $constraint);
@@ -58,7 +58,7 @@ method results are matched against the constraints.
5858
class User
5959
{
6060
/**
61-
* @Assert\MinLength(3)
61+
* @Assert\Length(min = 3)
6262
* @Assert\NotBlank
6363
*/
6464
private $name;

0 commit comments

Comments
 (0)
0