[2.0] Added validation to RunSqlTask
This commit is contained in:
parent
2e04cba8b3
commit
4fa4d7a8ca
@ -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.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user