Skip to content

Commit 1a425cc

Browse files
committed
[#3229] Adding some additional notes so it doesn't look like magic
1 parent b535d86 commit 1a425cc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

book/validation.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ simple example from inside a controller::
129129
$errors = $validator->validate($author);
130130

131131
if (count($errors) > 0) {
132-
return new Response($errors);
132+
/*
133+
* Uses a __toString method on the $errors variable which is a
134+
* ConstraintViolationList object. This gives us a nice string
135+
* for debugging
136+
*/
137+
$errorsString = (string) $errors;
138+
139+
return new Response($errorsString);
133140
}
134141

135142
return new Response('The author is valid! Yes!');

0 commit comments

Comments
 (0)