mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-23 01:57:50 +08:00
Fixes #5176: ActiveFixture will reset table in its load() method instead of unload()
This commit is contained in:
@@ -285,6 +285,7 @@ Yii Framework 2 Change Log
|
||||
- Chg #4955: Replaced callbacks with events for `ActiveForm` (qiangxue)
|
||||
- Removed `beforeValidate()`, `beforeValidateAll()`, `afterValidate()`, `afterValidateAll()`, `ajaxBeforeSend()` and `ajaxComplete()` from `ActiveForm`.
|
||||
- Added `beforeValidate`, `afterValidate`, `beforeValidateAttribute`, `afterValidateAttribute`, `beforeSubmit`, `ajaxBeforeSend` and `ajaxComplete` events to `yii.activeForm` jQuery plugin.
|
||||
- Chg #5176: `ActiveFixture` will reset table in its `load()` method instead of `unload()` (qiangxue)
|
||||
- Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
|
||||
- Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue)
|
||||
- Chg: `yii\grid\DataColumn::getDataCellValue()` visibility is now `public` to allow accessing the value from a GridView directly (cebe)
|
||||
|
||||
@@ -65,6 +65,7 @@ class ActiveFixture extends BaseActiveFixture
|
||||
/**
|
||||
* Loads the fixture.
|
||||
*
|
||||
* The default implementation will first clean up the table by calling [[resetTable()]].
|
||||
* It will then populate the table with the data returned by [[getData()]].
|
||||
*
|
||||
* If you override this method, you should consider calling the parent implementation
|
||||
@@ -72,10 +73,9 @@ class ActiveFixture extends BaseActiveFixture
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
parent::load();
|
||||
|
||||
$this->resetTable();
|
||||
$this->data = [];
|
||||
$table = $this->getTableSchema();
|
||||
|
||||
foreach ($this->getData() as $alias => $row) {
|
||||
$this->db->createCommand()->insert($table->fullName, $row)->execute();
|
||||
if ($table->sequenceName !== null) {
|
||||
@@ -90,17 +90,6 @@ class ActiveFixture extends BaseActiveFixture
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unloads the fixture.
|
||||
*
|
||||
* The default implementation will clean up the table by calling [[resetTable()]].
|
||||
*/
|
||||
public function unload()
|
||||
{
|
||||
$this->resetTable();
|
||||
parent::unload();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the fixture data.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user