Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
6ec11533
Commit
6ec11533
authored
Feb 04, 2013
by
ver1tas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed Assert\MinLength to Assert\Length in doc
parent
b356c04f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
doc/providers/form.rst
doc/providers/form.rst
+1
-1
doc/providers/validator.rst
doc/providers/validator.rst
+9
-9
No files found.
doc/providers/form.rst
View file @
6ec11533
...
@@ -150,7 +150,7 @@ form by adding constraints on the fields::
...
@@ -150,7 +150,7 @@ form by adding constraints on the fields::
$form = $app['form.factory']->createBuilder('form')
$form = $app['form.factory']->createBuilder('form')
->add('name', 'text', array(
->add('name', 'text', array(
'constraints' => array(new Assert\NotBlank(), new Assert\
MinLength(5
))
'constraints' => array(new Assert\NotBlank(), new Assert\
Length(array('min' => 5)
))
))
))
->add('email', 'text', array(
->add('email', 'text', array(
'constraints' => new Assert\Email()
'constraints' => new Assert\Email()
...
...
doc/providers/validator.rst
View file @
6ec11533
...
@@ -99,10 +99,10 @@ collection of constraints::
...
@@ -99,10 +99,10 @@ collection of constraints::
);
);
$constraint = new Assert\Collection(array(
$constraint = new Assert\Collection(array(
'title' => new Assert\
MinLength(10
),
'title' => new Assert\
Length(array('min' => 10)
),
'author' => new Assert\Collection(array(
'author' => new Assert\Collection(array(
'first_name' => array(new Assert\NotBlank(), new Assert\
MinLength(10
)),
'first_name' => array(new Assert\NotBlank(), new Assert\
Length(array('min' => 10)
)),
'last_name' => new Assert\
MinLength(
10),
'last_name' => new Assert\
Length(array('min'=>
10),
)),
)),
));
));
$errors = $app['validator']->validateValue($book, $constraint);
$errors = $app['validator']->validateValue($book, $constraint);
...
@@ -133,11 +133,11 @@ the class properties and getters, and then call the ``validate`` method::
...
@@ -133,11 +133,11 @@ the class properties and getters, and then call the ``validate`` method::
$metadata = $app['validator.mapping.class_metadata_factory']->getClassMetadata('Author');
$metadata = $app['validator.mapping.class_metadata_factory']->getClassMetadata('Author');
$metadata->addPropertyConstraint('first_name', new Assert\NotBlank());
$metadata->addPropertyConstraint('first_name', new Assert\NotBlank());
$metadata->addPropertyConstraint('first_name', new Assert\
MinLength(10
));
$metadata->addPropertyConstraint('first_name', new Assert\
Length(array('min' => 10)
));
$metadata->addPropertyConstraint('last_name', new Assert\
MinLength(10
));
$metadata->addPropertyConstraint('last_name', new Assert\
Length(array('min' => 10)
));
$metadata = $app['validator.mapping.class_metadata_factory']->getClassMetadata('Book');
$metadata = $app['validator.mapping.class_metadata_factory']->getClassMetadata('Book');
$metadata->addPropertyConstraint('title', new Assert\
MinLength(10
));
$metadata->addPropertyConstraint('title', new Assert\
Length(array('min' => 10)
));
$metadata->addPropertyConstraint('author', new Assert\Valid());
$metadata->addPropertyConstraint('author', new Assert\Valid());
$errors = $app['validator']->validate($book);
$errors = $app['validator']->validate($book);
...
@@ -163,7 +163,7 @@ You can also declare the class constraint by adding a static
...
@@ -163,7 +163,7 @@ You can also declare the class constraint by adding a static
static public function loadValidatorMetadata(ClassMetadata $metadata)
static public function loadValidatorMetadata(ClassMetadata $metadata)
{
{
$metadata->addPropertyConstraint('title', new Assert\
MinLength(10
));
$metadata->addPropertyConstraint('title', new Assert\
Length(array('min' => 10)
));
$metadata->addPropertyConstraint('author', new Assert\Valid());
$metadata->addPropertyConstraint('author', new Assert\Valid());
}
}
}
}
...
@@ -176,8 +176,8 @@ You can also declare the class constraint by adding a static
...
@@ -176,8 +176,8 @@ You can also declare the class constraint by adding a static
static public function loadValidatorMetadata(ClassMetadata $metadata)
static public function loadValidatorMetadata(ClassMetadata $metadata)
{
{
$metadata->addPropertyConstraint('first_name', new Assert\NotBlank());
$metadata->addPropertyConstraint('first_name', new Assert\NotBlank());
$metadata->addPropertyConstraint('first_name', new Assert\
MinLength(10
));
$metadata->addPropertyConstraint('first_name', new Assert\
Length(array('min' => 10)
));
$metadata->addPropertyConstraint('last_name', new Assert\
MinLength(10
));
$metadata->addPropertyConstraint('last_name', new Assert\
Length(array('min' => 10)
));
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment