Commit 3e58491b by Mark Committed by Qiang Xue

fixed docs

parent 461576dc
......@@ -279,7 +279,8 @@ Loading fixtures
----------------
Fixture classes should be suffixed by `Fixture` class. By default fixtures will be searched under `tests\unit\fixtures` namespace, you can
change this behavior with config or command options.
change this behavior with config or command options. Note that you can also append fixtures data to already existing ones with command
option `--append`. You can exclude some fixtures due load or unload by specifying `-` before its name like `-User`.
To load fixture, run the following command:
......@@ -291,14 +292,17 @@ The required `fixture_name` parameter specifies a fixture name which data will b
Below are correct formats of this command:
```
// load `users` fixture
// load `User` fixture
yii fixture/load User
// same as above, because default action of "fixture" command is "load"
yii fixture User
// load several fixtures. Note that there should not be any whitespace between ",", it should be one string.
yii fixture User,UserProfile
// load several fixtures
yii fixture User UserProfile
//load fixture, but dont clean storage before load and just append to already existed data
yii fixture User --append
// load all fixtures
yii fixture/load all
......@@ -306,8 +310,8 @@ yii fixture/load all
// same as above
yii fixture all
// load fixtures, but for other database connection.
yii fixture User --db='customDbConnectionId'
// load all fixtures except ones
yii fixture all -DoNotLoadThisOne
// load fixtures, but search them in different namespace. By default namespace is: tests\unit\fixtures.
yii fixture User --namespace='alias\my\custom\namespace'
......@@ -327,14 +331,18 @@ To unload fixture, run the following command:
// unload Users fixture, by default it will clear fixture storage (for example "users" table, or "users" collection if this is mongodb fixture).
yii fixture/unload User
// Unload several fixtures. Note that there should not be any whitespace between ",", it should be one string.
// Unload several fixtures
yii fixture/unload User,UserProfile
// unload all fixtures
yii fixture/unload all
// unload all fixtures except ones
yii fixture/unload all -DoNotUnloadThisOne
```
Same command options like: `db`, `namespace`, `globalFixtures` also can be applied to this command.
Same command options like: `namespace`, `globalFixtures` also can be applied to this command.
Configure Command Globally
--------------------------
......@@ -346,7 +354,6 @@ different migration path as follows:
'controllerMap' => [
'fixture' => [
'class' => 'yii\console\controllers\FixtureController',
'db' => 'customDbConnectionId',
'namespace' => 'myalias\some\custom\namespace',
'globalFixtures' => [
'some\name\space\Foo',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment