Commit 1ad7e5f7 by Qiang Xue

Fixes #5508: Dropped the support for the `--append` option for the `fixture` command

parent 7e0a42fc
...@@ -279,8 +279,7 @@ Loading fixtures ...@@ -279,8 +279,7 @@ Loading fixtures
---------------- ----------------
Fixture classes should be suffixed by `Fixture` class. By default fixtures will be searched under `tests\unit\fixtures` namespace, you can 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. Note that you can also append fixtures data to already existing ones with command change this behavior with config or command options. You can exclude some fixtures due load or unload by specifying `-` before its name like `-User`.
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: To load fixture, run the following command:
...@@ -301,9 +300,6 @@ yii fixture User ...@@ -301,9 +300,6 @@ yii fixture User
// load several fixtures // load several fixtures
yii fixture User UserProfile yii fixture User UserProfile
//load fixture, but don't clean storage before load and just append to already existed data
yii fixture User --append
// load all fixtures // load all fixtures
yii fixture/load "*" yii fixture/load "*"
......
...@@ -26,6 +26,7 @@ Yii Framework 2 Change Log ...@@ -26,6 +26,7 @@ Yii Framework 2 Change Log
- Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk) - Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk)
- Enh: `Console::confirm()` now uses `Console::stdout()` instead of `echo` to be consistent with all other functions (cebe) - Enh: `Console::confirm()` now uses `Console::stdout()` instead of `echo` to be consistent with all other functions (cebe)
- Chg #3630: `yii\db\Command::queryInternal()` is now protected (samdark) - Chg #3630: `yii\db\Command::queryInternal()` is now protected (samdark)
- Chg #5508: Dropped the support for the `--append` option for the `fixture` command (qiangxue)
2.0.0 October 12, 2014 2.0.0 October 12, 2014
---------------------- ----------------------
......
...@@ -30,9 +30,6 @@ use yii\test\FixtureTrait; ...@@ -30,9 +30,6 @@ use yii\test\FixtureTrait;
* #load all fixtures except User * #load all fixtures except User
* yii fixture "*" -User * yii fixture "*" -User
* *
* #append fixtures to already loaded
* yii fixture User --append
*
* #load fixtures with different namespace. * #load fixtures with different namespace.
* yii fixture/load User --namespace=alias\my\custom\namespace\goes\here * yii fixture/load User --namespace=alias\my\custom\namespace\goes\here
* ~~~ * ~~~
...@@ -55,11 +52,6 @@ class FixtureController extends Controller ...@@ -55,11 +52,6 @@ class FixtureController extends Controller
*/ */
public $namespace = 'tests\unit\fixtures'; public $namespace = 'tests\unit\fixtures';
/** /**
* @var boolean whether to append new fixture data to the existing ones.
* Defaults to false, meaning if there is any existing fixture data, it will be removed.
*/
public $append = false;
/**
* @var array global fixtures that should be applied when loading and unloading. By default it is set to `InitDbFixture` * @var array global fixtures that should be applied when loading and unloading. By default it is set to `InitDbFixture`
* that disables and enables integrity check, so your data can be safely loaded. * that disables and enables integrity check, so your data can be safely loaded.
*/ */
...@@ -74,7 +66,7 @@ class FixtureController extends Controller ...@@ -74,7 +66,7 @@ class FixtureController extends Controller
public function options($actionID) public function options($actionID)
{ {
return array_merge(parent::options($actionID), [ return array_merge(parent::options($actionID), [
'namespace', 'globalFixtures', 'append' 'namespace', 'globalFixtures'
]); ]);
} }
...@@ -87,10 +79,6 @@ class FixtureController extends Controller ...@@ -87,10 +79,6 @@ class FixtureController extends Controller
* # any existing fixture data will be removed first * # any existing fixture data will be removed first
* yii fixture/load User UserProfile * yii fixture/load User UserProfile
* *
* # load the fixture data specified by User and UserProfile.
* # the new fixture data will be appended to the existing one
* yii fixture/load --append User UserProfile
*
* # load all available fixtures found under 'tests\unit\fixtures' * # load all available fixtures found under 'tests\unit\fixtures'
* yii fixture/load "*" * yii fixture/load "*"
* *
...@@ -100,7 +88,7 @@ class FixtureController extends Controller ...@@ -100,7 +88,7 @@ class FixtureController extends Controller
* *
* @throws Exception if the specified fixture does not exist. * @throws Exception if the specified fixture does not exist.
*/ */
public function actionLoad($fixturesInput) public function actionLoad()
{ {
$fixturesInput = func_get_args(); $fixturesInput = func_get_args();
$filtered = $this->filterFixtures($fixturesInput); $filtered = $this->filterFixtures($fixturesInput);
...@@ -147,12 +135,11 @@ class FixtureController extends Controller ...@@ -147,12 +135,11 @@ class FixtureController extends Controller
$fixturesObjects = $this->createFixtures($fixtures); $fixturesObjects = $this->createFixtures($fixtures);
if (!$this->append) { $this->unloadFixtures($fixturesObjects);
$this->unloadFixtures($fixturesObjects);
}
$this->loadFixtures($fixturesObjects); $this->loadFixtures($fixturesObjects);
$this->notifyLoaded($fixtures); $this->notifyLoaded($fixtures);
return static::EXIT_CODE_NORMAL;
} }
/** /**
......
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