Commit 04ecee29 authored by Daniel Lima's avatar Daniel Lima

Update validator.rst

Example from documentation throws `Call to undefined method Symfony\Component\Validator\Validator\RecursiveValidator::validateValue()`
parent bf071d40
......@@ -49,13 +49,13 @@ The Validator provider provides a ``validator`` service.
Validating Values
~~~~~~~~~~~~~~~~~
You can validate values directly using the ``validateValue`` validator
You can validate values directly using the ``validate`` validator
method::
use Symfony\Component\Validator\Constraints as Assert;
$app->get('/validate/{email}', function ($email) use ($app) {
$errors = $app['validator']->validateValue($email, new Assert\Email());
$errors = $app['validator']->validate($email, new Assert\Email());
if (count($errors) > 0) {
return (string) $errors;
......@@ -99,7 +99,7 @@ collection of constraints::
'last_name' => new Assert\Length(array('min' => 10)),
)),
));
$errors = $app['validator']->validateValue($book, $constraint);
$errors = $app['validator']->validate($book, $constraint);
if (count($errors) > 0) {
foreach ($errors as $error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment