@@ -37,9 +37,40 @@ to validate a string against a specific length, the only code you need is::
37
37
}
38
38
}
39
39
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\V alidator\V alidation `
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
+
40
69
Sections
41
70
--------
42
71
43
- * :doc: `/components/validator/configuration `
72
+ * :doc: `/components/validator/loading_resources `
73
+ * :doc: `/components/validator/defining_metadata `
74
+ * :doc: `/components/validator/validating_values `
44
75
45
76
.. _`JSR-303 Bean Validation specification` : http://jcp.org/en/jsr/detail?id=303
0 commit comments