Commit 4fa4d7a8 authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Added validation to RunSqlTask

parent 2e04cba8
...@@ -44,6 +44,29 @@ class RunSqlTask extends AbstractTask ...@@ -44,6 +44,29 @@ class RunSqlTask extends AbstractTask
->writeln(' --file=<path> | --sql=<SQL>', 'INFO'); ->writeln(' --file=<path> | --sql=<SQL>', 'INFO');
} }
/**
* @inheritdoc
*/
public function validate()
{
if ( ! parent::validate()) {
return false;
}
$args= $this->getArguments();
$isSql = isset($args['sql']);
$isFile = isset($args['file']);
if ( ! ($isSql ^ $isFile)) {
$printer->writeln("One of --sql or --file required, and only one.", 'ERROR');
return false;
}
return true;
}
/** /**
* Executes the task. * Executes the task.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment