diff --git a/extensions/faker/FixtureController.php b/extensions/faker/FixtureController.php index ccf5d7e..390ac34 100644 --- a/extensions/faker/FixtureController.php +++ b/extensions/faker/FixtureController.php @@ -14,13 +14,13 @@ use yii\helpers\FileHelper; use yii\helpers\VarDumper; /** - * This command manage fixtures creations based on given template. + * This command creates fixtures based on a given template. * * Fixtures are one of the important paths in unit testing. To speed up developers * work these fixtures can be generated automatically, based on prepared template. - * This command is a simple wrapper for the fixtures library [Faker](https://github.com/fzaninotto/Faker). + * This command is a simple wrapper for the [Faker](https://github.com/fzaninotto/Faker) library. * - * You should configure this command as follows (you can use any alias, not only "fixture"): + * You should configure your application as follows (you can use any alias, not only "fixture"): * * ~~~ * 'controllerMap' => [ @@ -30,7 +30,7 @@ use yii\helpers\VarDumper; * ], * ~~~ * - * To start using this command you need to be familiar (read guide) for the Faker library and + * To start using the command you need to be familiar (read guide) with the Faker library and * generate fixtures template files, according to the given format: * * ```php @@ -45,7 +45,7 @@ use yii\helpers\VarDumper; * ]; * ``` * - * If you use callback as a attribute value, then it will be called as shown with three parameters: + * If you use callback as an attribute value it will be called with the following three parameters: * * - `$faker`: the Faker generator instance * - `$index`: the current fixture index. For example if user need to generate 3 fixtures for user table, it will be 0..2. diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 5fcedc4..05a649d 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -71,6 +71,7 @@ Yii Framework 2 Change Log - Enh: `Console::confirm()` now uses `Console::stdout()` instead of `echo` to be consistent with all other functions (cebe) - Enh: `yii\rbac\DbManager` migration now uses database component specified in component settings instead of always using default `db` (samdark) - Enh: Added `yii\base\Controller::renderContent()` (qiangxue) +- Enh: `yii fixture` command now offers help if no arguments are provided instead of crashing (samdark) - Chg #3630: `yii\db\Command::queryInternal()` is now protected (samdark) - Chg #4277: `yii\grid\GridView` is no longer throwing an exception when results are empty and `columns` aren't defined (samdark) - Chg #5508: Dropped the support for the `--append` option for the `fixture` command (qiangxue) diff --git a/framework/console/controllers/FixtureController.php b/framework/console/controllers/FixtureController.php index a1a6a36..7256d46 100644 --- a/framework/console/controllers/FixtureController.php +++ b/framework/console/controllers/FixtureController.php @@ -91,6 +91,15 @@ class FixtureController extends Controller public function actionLoad() { $fixturesInput = func_get_args(); + 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"); + + return self::EXIT_CODE_NORMAL; + } + $filtered = $this->filterFixtures($fixturesInput); $except = $filtered['except'];