diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 95028eeab7..44b978c0cd 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -8,6 +8,7 @@ Yii Framework 2 Change Log - Bug #17156: Fixes PHP 7.2 warning when a data provider has no data as a parameter for a GridView (evilito) - Bug #17083: Fixed `yii\validators\EmailValidator::$checkDNS` tells that every domain is correct on alpine linux (mikk150) - Bug #17180: Do not populate `yii\web\Response::$response` when response code is 204 (mikk150) +- Bug #17124: Fixed ErrorException when run `./yii fixture/unload` without arguments (ricpelo) 2.0.16.1 February 28, 2019 diff --git a/framework/console/controllers/FixtureController.php b/framework/console/controllers/FixtureController.php index 0ad64e81ef..da7fc1e042 100644 --- a/framework/console/controllers/FixtureController.php +++ b/framework/console/controllers/FixtureController.php @@ -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