Skip to content

Instantly share code, notes, and snippets.

@JoshuaEstes
Created October 9, 2015 19:14
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 JoshuaEstes/e3dec0df7cbafc3e97d0 to your computer and use it in GitHub Desktop.
Save JoshuaEstes/e3dec0df7cbafc3e97d0 to your computer and use it in GitHub Desktop.
<?php
protected function interact(InputInterface $input, OutputInterface $output)
{
$dialog = $this->getDialogHelper();
$validator = Validation::createValidator();
$inputValue = $dialog->ask($output, 'Enter some input: ');
$errors = $validator->validateValue($inputValue, new Assert\NotBlank());
if (count($errors)) {
throw new \RuntimeException('Input cannot be blank');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment