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
21160338
Commit
21160338
authored
Jun 02, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented default controller namespace.
parent
8435285c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
main.php
apps/basic/config/main.php
+0
-1
Module.php
framework/yii/base/Module.php
+15
-1
No files found.
apps/basic/config/main.php
View file @
21160338
...
...
@@ -4,7 +4,6 @@ return array(
'id'
=>
'bootstrap'
,
'basePath'
=>
dirname
(
__DIR__
),
'preload'
=>
array
(
'log'
),
'controllerNamespace'
=>
'app\controllers'
,
'modules'
=>
array
(
// 'debug' => array(
// 'class' => 'yii\debug\Module',
...
...
framework/yii/base/Module.php
View file @
21160338
...
...
@@ -88,7 +88,11 @@ abstract class Module extends Component
*/
public
$controllerMap
=
array
();
/**
* @var string the namespace that controller classes are in. Default is to use global namespace.
* @var string the namespace that controller classes are in. If not set,
* it will use the "controllers" sub-namespace under the namespace of this module.
* For example, if the namespace of this module is "foo\bar", then the default
* controller namespace would be "foo\bar\controllers".
* If the module is an application, it will default to "app\controllers".
*/
public
$controllerNamespace
;
/**
...
...
@@ -178,6 +182,16 @@ abstract class Module extends Component
public
function
init
()
{
$this
->
preloadComponents
();
if
(
$this
->
controllerNamespace
===
null
)
{
if
(
$this
instanceof
Application
)
{
$this
->
controllerNamespace
=
'app\\controllers'
;
}
else
{
$class
=
get_class
(
$this
);
if
((
$pos
=
strrpos
(
$class
,
'\\'
))
!==
false
)
{
$this
->
controllerNamespace
=
substr
(
$class
,
0
,
$pos
)
.
'\\controllers'
;
}
}
}
}
/**
...
...
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