Created
February 9, 2013 21:31
-
-
Save fago/4747199 to your computer and use it in GitHub Desktop.
executable validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements \Drupal\Core\Executable\ExecutableInterface::valdidate(). | |
*/ | |
public function valdidate() { | |
$violations = new \Symfony\Component\Validator\ConstraintViolationList(); | |
if ($definitions = $this->getContextDefinitions()) { | |
foreach ($definitions as $key => $definition) { | |
// Validate any set values. | |
if (isset($this->context[$key])) { | |
$typed_context = $this->context[$key]->getTypedContext(); | |
$violations->addAll($typed_context->validate()); | |
} | |
// @todo: If no value is set, make sure any mapping is validated. | |
} | |
} | |
return $violations; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment