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
9f74bba3
Commit
9f74bba3
authored
Jan 02, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor fixes.
parent
4c45b429
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
FixtureController.php
framework/yii/console/controllers/FixtureController.php
+10
-8
No files found.
framework/yii/console/controllers/FixtureController.php
View file @
9f74bba3
...
@@ -8,8 +8,9 @@
...
@@ -8,8 +8,9 @@
namespace
yii\console\controllers
;
namespace
yii\console\controllers
;
use
Yii
;
use
Yii
;
use
yii\base\InvalidConfigException
;
use
yii\console\Controller
;
use
yii\console\Controller
;
use
yii\
console\Exception
;
use
yii\
test\DbTestTrait
;
/**
/**
* This command manages fixtures load to the database tables.
* This command manages fixtures load to the database tables.
...
@@ -51,7 +52,7 @@ use yii\console\Exception;
...
@@ -51,7 +52,7 @@ use yii\console\Exception;
class
FixtureController
extends
Controller
class
FixtureController
extends
Controller
{
{
use
\yii\test\
DbTestTrait
;
use
DbTestTrait
;
/**
/**
* @var string controller default action ID.
* @var string controller default action ID.
...
@@ -104,8 +105,8 @@ class FixtureController extends Controller
...
@@ -104,8 +105,8 @@ class FixtureController extends Controller
*/
*/
public
function
actionApply
(
$fixture
)
public
function
actionApply
(
$fixture
)
{
{
$this
->
fixtureManager
->
basePath
=
$this
->
fixturePath
;
$this
->
getFixtureManager
()
->
basePath
=
$this
->
fixturePath
;
$this
->
fixtureManager
->
db
=
$this
->
db
;
$this
->
getFixtureManager
()
->
db
=
$this
->
db
;
$this
->
loadFixtures
([
$fixture
]);
$this
->
loadFixtures
([
$fixture
]);
}
}
...
@@ -121,28 +122,29 @@ class FixtureController extends Controller
...
@@ -121,28 +122,29 @@ class FixtureController extends Controller
/**
/**
* Checks if the database and fixtures path are available.
* Checks if the database and fixtures path are available.
* @throws Exception
* @throws
InvalidConfig
Exception
*/
*/
public
function
checkRequirements
()
public
function
checkRequirements
()
{
{
$path
=
Yii
::
getAlias
(
$this
->
fixturePath
,
false
);
$path
=
Yii
::
getAlias
(
$this
->
fixturePath
,
false
);
if
(
!
is_dir
(
$path
)
||
!
is_writable
(
$path
))
{
if
(
!
is_dir
(
$path
)
||
!
is_writable
(
$path
))
{
throw
new
Exception
(
"The fixtures path
\"
{
$this
->
fixturePath
}
\"
not exist or is not writable"
);
throw
new
InvalidConfig
Exception
(
"The fixtures path
\"
{
$this
->
fixturePath
}
\"
not exist or is not writable"
);
}
}
}
}
/**
/**
* Returns database connection component
* Returns database connection component
* @return \yii\db\Connection|null
* @return \yii\db\Connection
* @throws InvalidConfigException if [[db]] is invalid.
*/
*/
public
function
getDbConnection
()
public
function
getDbConnection
()
{
{
$db
=
Yii
::
$app
->
getComponent
(
$this
->
db
);
$db
=
Yii
::
$app
->
getComponent
(
$this
->
db
);
if
(
$db
==
null
)
{
if
(
$db
==
null
)
{
throw
new
Exception
(
"There is no database connection component with id
\"
{
$this
->
db
}
\"
."
);
throw
new
InvalidConfig
Exception
(
"There is no database connection component with id
\"
{
$this
->
db
}
\"
."
);
}
}
return
$db
;
return
$db
;
...
...
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