Skip to content

Instantly share code, notes, and snippets.

@bakura10
Created September 2, 2013 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakura10/6413545 to your computer and use it in GitHub Desktop.
Save bakura10/6413545 to your computer and use it in GitHub Desktop.
<?php
// In the InputCollection class, I have this.
// Basically, the issue is that when user called "validate", it should returns a "ValidationResult" object. However,
// this method needs to recursively calls each children input collection. BUT I don't want the children input filter to
// return a validation result, instead I want them return a simple array of error messages, that will be aggregated by
// the top input collection.
//
// I've thought about having validate(array $data, $context = null, $buildValidationResult = false);
// But it's ugly
// I think it'd be better to split this method into two, with a protected method that return error messages.
// Idea about naming?
/**
* {@inheritDoc}
*/
public function validate(array $data, $context = null)
{
$iterator = $this->getValidationGroupFilter();
$iteratorIterator = new IteratorIterator($iterator);
foreach ($iteratorIterator as $inputOrInputCollection) {
if ($inputOrInputCollection instanceof InputInterface) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment