Commit 5e33a17b by Mark

fixed active fixtures classes

parent b892ffc8
......@@ -53,12 +53,12 @@ class ActiveFixture extends BaseActiveFixture
/**
* Loads the fixture data.
* The default implementation will first reset the DB table and then populate it with the data
* returned by [[getData()]].
* Data will be batch inserted into the given collection.
*/
public function load()
{
$this->resetCollection();
parent::load();
$data = $this->getData();
$this->getCollection()->batchInsert($data);
foreach ($data as $alias => $row) {
......@@ -66,6 +66,17 @@ class ActiveFixture extends BaseActiveFixture
}
}
/**
* Unloads the fixture.
*
* The default implementation will clean up the colection by calling [[resetCollection()]].
*/
public function unload()
{
$this->resetCollection();
parent::unload();
}
protected function getCollection()
{
return $this->db->getCollection($this->getCollectionName());
......
......@@ -65,7 +65,6 @@ 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
......@@ -73,7 +72,7 @@ class ActiveFixture extends BaseActiveFixture
*/
public function load()
{
$this->resetTable();
parent::load();
$table = $this->getTableSchema();
......@@ -92,6 +91,17 @@ 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.
*
* The default implementation will try to return the fixture data by including the external file specified by [[dataFile]].
......
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