symfony3 Validation

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

In fact, form validation is based from a component, named "Validator Component".

You can often use the dedicated service if you did't have to show a form in a template. Like APIs. You may validate datas in the same way, like this :

For example, based on symfony doc :

$validator = $this->get('validator');
$errors = $validator->validate($author);

if (count($errors) > 0) {
    /*
     * Uses a __toString method on the $errors variable which is a
     * ConstraintViolationList object. This gives us a nice string
     * for debugging.
     */
    $errorsString = (string) $errors;
}


Got any symfony3 Question?