Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Created July 28, 2015 10:26
Show Gist options
  • Save tvlooy/120189a941955dca4922 to your computer and use it in GitHub Desktop.
Save tvlooy/120189a941955dca4922 to your computer and use it in GitHub Desktop.
Symfony validator without entities or objects
<?php
// See http://symfony.com/doc/current/book/validation.html#validating-values-and-arrays
$email = $app['request']->get('email');
$emailConstraint = new \Symfony\Component\Validator\Constraints\Email();
$emailConstraint->message = 'Invalid email address';
$errorList = $val->validate(
$email,
$emailConstraint
);
var_dump($errorList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment