Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
protected function interact(InputInterface $input, OutputInterface $output)
{
$dialog = $this->getDialogHelper();
$validator = Validation::createValidator();
$inputValue = $dialog->askAndValidate($output, 'Enter some input: ', function($value) use($validator){
$errors = $validator->validateValue($value, new Assert\NotBlank());
if (count($errors)) {
throw new \InvalidArgumentException((string) $errors);
}
return $value;
});
$MoreInputValue = $dialog->askAndValidate($output, 'Enter even more input input: ', function($value) use($validator){
$errors = $validator->validateValue($value, new Assert\NotBlank());
if (count($errors)) {
throw new \InvalidArgumentException((string) $errors);
}
return $value;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.