This commit is contained in:
Simon Vieille 2016-05-22 23:39:06 +02:00
parent 522e7f9032
commit 36938bba66

View file

@ -42,6 +42,9 @@ $validator->addFieldConstraint(0, new Email());
// The second field must contain a date
$validator->addFieldConstraint(1, new Date());
// Validate the legend
$validator->setExceptedLegend(array('foo', 'bar', 'bim'));
// An line must contain 3 columns
$validator->addDataConstraint(new Callback(function($data, ExecutionContextInterface $context) {
if (count($data) !== 6) { // 6 because of the legend (3 fields * 2)