I want to do simple validation on a string using symfony2 Validator Component. (This needs to be in symfony 2.0)
$responseEmail = 'somestring';
$validator = new Validator(
new ClassMetadataFactory(new StaticMethodLoader()),
new ConstraintValidatorFactory()
);
$constraint = new Assert\Collection(array(
'responseEmail' => new Assert\Collection(array(
new Assert\Email(),
new Assert\NotNull(),
)),
));
$violations = $validator->validateValue(array('responseEmail' => $responseEmail), $constraint);
This gives me an error:
Expected argument of type array or Traversable and ArrayAccess, string given
Anyone knows why?
$responseMailand$responseEmail?