Fixes #17124: Fixed ErrorException when run ./yii fixture/unload without arguments

This commit is contained in:
Ricardo Pérez
2019-03-06 15:34:34 +01:00
committed by Alexander Makarov
parent fc98a95a90
commit e6513a2c9e
2 changed files with 19 additions and 5 deletions

View File

@ -109,11 +109,7 @@ class FixtureController extends Controller
public function actionLoad(array $fixturesInput = [])
{
if ($fixturesInput === []) {
$this->stdout($this->getHelpSummary() . "\n");
$helpCommand = Console::ansiFormat('yii help fixture', [Console::FG_CYAN]);
$this->stdout("Use $helpCommand to get usage info.\n");
$this->printHelpMessage();
return ExitCode::OK;
}
@ -188,6 +184,11 @@ class FixtureController extends Controller
*/
public function actionUnload(array $fixturesInput = [])
{
if ($fixturesInput === []) {
$this->printHelpMessage();
return ExitCode::OK;
}
$filtered = $this->filterFixtures($fixturesInput);
$except = $filtered['except'];
@ -232,6 +233,18 @@ class FixtureController extends Controller
$this->notifyUnloaded($fixtures);
}
/**
* Show help message.
* @param array $fixturesInput
*/
private function printHelpMessage()
{
$this->stdout($this->getHelpSummary() . "\n");
$helpCommand = Console::ansiFormat('yii help fixture', [Console::FG_CYAN]);
$this->stdout("Use $helpCommand to get usage info.\n");
}
/**
* Notifies user that fixtures were successfully loaded.
* @param array $fixtures