Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
d5d810dd
Commit
d5d810dd
authored
11 years ago
by
kate-kate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
local data variable and some code style fixation
parent
0d35c269
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
ActiveFixture.php
extensions/mongodb/ActiveFixture.php
+9
-7
No files found.
extensions/mongodb/ActiveFixture.php
View file @
d5d810dd
...
...
@@ -7,15 +7,16 @@ use yii\base\InvalidConfigException;
class
ActiveFixture
extends
\yii\test\BaseActiveFixture
{
/**
* @var Connection|string the DB connection object or the application component ID of the DB connection.
*/
public
$db
=
'mongodb'
;
/**
* @var string
the name of the collection
that this fixture is about. If this property is not set,
* @var string
|array the collection name
that this fixture is about. If this property is not set,
* the table name will be determined via [[modelClass]].
* @see
modelClass
* @see
[[yii\mongodb\Connection::getCollection()]]
*/
public
$collectionName
;
/**
* @var string the file path or path alias of the data file that contains the fixture data
* and will be loaded by [[loadData()]]. If this is not set, it will default to `FixturePath/data/TableName.php`,
...
...
@@ -24,6 +25,7 @@ class ActiveFixture extends \yii\test\BaseActiveFixture
*/
public
$dataFile
;
/**
* @inheritdoc
*/
...
...
@@ -35,7 +37,6 @@ class ActiveFixture extends \yii\test\BaseActiveFixture
}
}
/**
* Loads the fixture data.
* The default implementation will first reset the DB table and then populate it with the data
...
...
@@ -44,8 +45,9 @@ class ActiveFixture extends \yii\test\BaseActiveFixture
public
function
load
()
{
$this
->
resetCollection
();
$this
->
getCollection
()
->
batchInsert
(
$this
->
getData
());
foreach
(
$this
->
getData
()
as
$alias
=>
$row
)
{
$data
=
$this
->
getData
();
$this
->
getCollection
()
->
batchInsert
(
$data
);
foreach
(
$data
as
$alias
=>
$row
)
{
$this
->
data
[
$alias
]
=
$row
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment