Fixes #5176: ActiveFixture will reset table in its load() method instead of unload()

This commit is contained in:
Qiang Xue
2014-09-25 12:27:09 -04:00
parent 014aab1b9a
commit 205400f118
3 changed files with 8 additions and 28 deletions

View File

@ -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.
*