mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 14:28:27 +08:00
Fixes #5508: Dropped the support for the --append
option for the fixture
command
This commit is contained in:
@ -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
|
|||||||
// 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
|
|||||||
- 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;
|
|||||||
* #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
|
||||||
* ~~~
|
* ~~~
|
||||||
@ -54,11 +51,6 @@ class FixtureController extends Controller
|
|||||||
* @var string default namespace to search fixtures in
|
* @var string default namespace to search fixtures in
|
||||||
*/
|
*/
|
||||||
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
|
|||||||
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
|
|||||||
* # 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
|
|||||||
*
|
*
|
||||||
* @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
|
|||||||
|
|
||||||
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user