16
16
*
17
17
* For example, let's validate the following object graph:
18
18
*
19
- * <pre>
20
- * (Person)---($firstName: string)
21
- * \
22
- * ($address: Address)---($street: string)
23
- * </pre>
19
+ * (Person)---($firstName: string)
20
+ * \
21
+ * ($address: Address)---($street: string)
24
22
*
25
23
* We validate the <tt>Person</tt> instance, which becomes the "root" of the
26
24
* validation run (see {@link getRoot}). The state of the context after the
27
25
* first step will be like this:
28
26
*
29
- * <pre>
30
- * (Person)---($firstName: string)
31
- * ^ \
32
- * ($address: Address)---($street: string)
33
- * </pre>
27
+ * (Person)---($firstName: string)
28
+ * ^ \
29
+ * ($address: Address)---($street: string)
34
30
*
35
31
* The validator is stopped at the <tt>Person</tt> node, both the root and the
36
32
* value (see {@link getValue}) of the context point to the <tt>Person</tt>
41
37
* After advancing to the property <tt>$firstName</tt> of the <tt>Person</tt>
42
38
* instance, the state of the context looks like this:
43
39
*
44
- * <pre>
45
- * (Person)---($firstName: string)
46
- * \ ^
47
- * ($address: Address)---($street: string)
48
- * </pre>
40
+ * (Person)---($firstName: string)
41
+ * \ ^
42
+ * ($address: Address)---($street: string)
49
43
*
50
44
* The validator is stopped at the property <tt>$firstName</tt>. The root still
51
45
* points to the <tt>Person</tt> instance, because this is where the validation
56
50
* <tt>$street</tt> property of the <tt>Address</tt> instance, the context state
57
51
* looks like this:
58
52
*
59
- * <pre>
60
- * (Person)---($firstName: string)
61
- * \
62
- * ($address: Address)---($street: string)
63
- * ^
64
- * </pre>
53
+ * (Person)---($firstName: string)
54
+ * \
55
+ * ($address: Address)---($street: string)
56
+ * ^
65
57
*
66
58
* The validator is stopped at the property <tt>$street</tt>. The root still
67
59
* points to the <tt>Person</tt> instance, but the property path is now
@@ -128,19 +120,14 @@ public function addViolationAt($subPath, $message, array $parameters = array(),
128
120
* argument which is appended to the current property path when a violation
129
121
* is created. For example, take the following object graph:
130
122
*
131
- * <pre>
132
- * (Person)---($address: Address)---($phoneNumber: PhoneNumber)
133
- * ^
134
- * </pre>
123
+ * (Person)---($address: Address)---($phoneNumber: PhoneNumber)
135
124
*
136
125
* When the execution context stops at the <tt>Person</tt> instance, the
137
126
* property path is "address". When you validate the <tt>PhoneNumber</tt>
138
127
* instance now, pass "phoneNumber" as sub path to correct the property path
139
128
* to "address.phoneNumber":
140
129
*
141
- * <pre>
142
- * $context->validate($address->phoneNumber, 'phoneNumber');
143
- * </pre>
130
+ * $context->validate($address->phoneNumber, 'phoneNumber');
144
131
*
145
132
* Any violations generated during the validation will be added to the
146
133
* violation list that you can access with {@link getViolations}.
@@ -167,19 +154,14 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals
167
154
* Use the parameter <tt>$subPath</tt> to adapt the property path for the
168
155
* validated value. For example, take the following object graph:
169
156
*
170
- * <pre>
171
- * (Person)---($address: Address)---($street: string)
172
- * ^
173
- * </pre>
157
+ * (Person)---($address: Address)---($street: string)
174
158
*
175
159
* When the validator validates the <tt>Address</tt> instance, the
176
160
* property path stored in the execution context is "address". When you
177
161
* manually validate the property <tt>$street</tt> now, pass the sub path
178
162
* "street" to adapt the full property path to "address.street":
179
163
*
180
- * <pre>
181
- * $context->validate($address->street, new NotNull(), 'street');
182
- * </pre>
164
+ * $context->validate($address->street, new NotNull(), 'street');
183
165
*
184
166
* @param mixed $value The value to validate
185
167
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
@@ -290,9 +272,7 @@ public function getPropertyName();
290
272
*
291
273
* For example, take the following object graph:
292
274
*
293
- * <pre>
294
- * (Person)---($address: Address)---($street: string)
295
- * </pre>
275
+ * (Person)---($address: Address)---($street: string)
296
276
*
297
277
* When the <tt>Person</tt> instance is passed to the validator, the
298
278
* property path is initially empty. When the <tt>$address</tt> property
0 commit comments