Skip to content

Commit e50e2fa

Browse files
wouterjweaverryan
authored andcommitted
Added small configuration section
1 parent 4549504 commit e50e2fa

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

components/validator/introduction.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,40 @@ to validate a string against a specific length, the only code you need is::
3737
}
3838
}
3939

40+
Retrieving a Validator Instance
41+
-------------------------------
42+
43+
The :class:`Symfony\\Component\\Validator\\Validator` class is the main access
44+
point of the Validator component. To create a new instance of this class, it
45+
is recomment to use the :class:`Symfony\\Component\Validator\Validation`
46+
class.
47+
48+
You can get the ``Validator`` with the default configuration by calling
49+
:method:`Validation::createValidator() <Symfony\\Component\\Validator\\Validation::createValidator>`::
50+
51+
use Symfony\Component\Validator\Validation;
52+
53+
$validator = Validation::createValidator();
54+
55+
However, a lot of things can be customized. To configure the ``Validator``
56+
class, you can use the :class:`Symfony\\Component\\Validator\\ValidatorBuilder`.
57+
This class can be retrieved by using the
58+
:method:`Validation::createValidatorBuilder() <Symfony\\Component\\Validator\\Validation::createValidatorBuilder>`
59+
method::
60+
61+
use Symfony\Component\Validator\Validation;
62+
63+
$validator = Validation::createValidatorBuilder()
64+
// ... build a custom instance of the Validator
65+
->getValidator();
66+
67+
What things you can configure will be documented in the following sections.
68+
4069
Sections
4170
--------
4271

43-
* :doc:`/components/validator/configuration`
72+
* :doc:`/components/validator/loading_resources`
73+
* :doc:`/components/validator/defining_metadata`
74+
* :doc:`/components/validator/validating_values`
4475

4576
.. _`JSR-303 Bean Validation specification`: http://jcp.org/en/jsr/detail?id=303

0 commit comments

Comments
 (0)