1
0
mirror of synced 2025-02-20 06:03:15 +03:00

[2.0] Added validation to RunSqlTask

This commit is contained in:
guilhermeblanco 2009-09-02 02:41:57 +00:00
parent 2e04cba8b3
commit 4fa4d7a8ca

View File

@ -44,6 +44,29 @@ class RunSqlTask extends AbstractTask
->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.
*/