forked from deblan/csv-validator
README
This commit is contained in:
parent
522e7f9032
commit
36938bba66
|
@ -42,6 +42,9 @@ $validator->addFieldConstraint(0, new Email());
|
||||||
// The second field must contain a date
|
// The second field must contain a date
|
||||||
$validator->addFieldConstraint(1, new Date());
|
$validator->addFieldConstraint(1, new Date());
|
||||||
|
|
||||||
|
// Validate the legend
|
||||||
|
$validator->setExceptedLegend(array('foo', 'bar', 'bim'));
|
||||||
|
|
||||||
// An line must contain 3 columns
|
// An line must contain 3 columns
|
||||||
$validator->addDataConstraint(new Callback(function($data, ExecutionContextInterface $context) {
|
$validator->addDataConstraint(new Callback(function($data, ExecutionContextInterface $context) {
|
||||||
if (count($data) !== 6) { // 6 because of the legend (3 fields * 2)
|
if (count($data) !== 6) { // 6 because of the legend (3 fields * 2)
|
||||||
|
|
Loading…
Reference in a new issue