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
35018bfb
Commit
35018bfb
authored
Mar 07, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored controller creation process.
parent
ad19e332
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
Module.php
framework/base/Module.php
+4
-3
No files found.
framework/base/Module.php
View file @
35018bfb
...
@@ -222,7 +222,10 @@ class Module extends Component
...
@@ -222,7 +222,10 @@ class Module extends Component
/**
/**
* Returns the directory that contains the controller classes according to [[controllerNamespace]].
* Returns the directory that contains the controller classes according to [[controllerNamespace]].
* Note that in order for this method to return a value, you must define
* an alias for the root namespace of [[controllerNamespace]].
* @return string the directory that contains the controller classes.
* @return string the directory that contains the controller classes.
* @throws InvalidParamException if there is no alias defined for the root namespace of [[controllerNamespace]].
*/
*/
public
function
getControllerPath
()
public
function
getControllerPath
()
{
{
...
@@ -670,13 +673,11 @@ class Module extends Component
...
@@ -670,13 +673,11 @@ class Module extends Component
}
}
$className
=
str_replace
(
' '
,
''
,
ucwords
(
str_replace
(
'-'
,
' '
,
$className
)))
.
'Controller'
;
$className
=
str_replace
(
' '
,
''
,
ucwords
(
str_replace
(
'-'
,
' '
,
$className
)))
.
'Controller'
;
$classFile
=
$this
->
getControllerPath
()
.
'/'
.
$prefix
.
$className
.
'.php'
;
$className
=
ltrim
(
$this
->
controllerNamespace
.
'\\'
.
str_replace
(
'/'
,
'\\'
,
$prefix
)
.
$className
,
'\\'
);
$className
=
ltrim
(
$this
->
controllerNamespace
.
'\\'
.
str_replace
(
'/'
,
'\\'
,
$prefix
)
.
$className
,
'\\'
);
if
(
strpos
(
$className
,
'-'
)
!==
false
||
!
is_file
(
$classFil
e
))
{
if
(
strpos
(
$className
,
'-'
)
!==
false
||
!
class_exists
(
$classNam
e
))
{
return
null
;
return
null
;
}
}
Yii
::
$classMap
[
$className
]
=
$classFile
;
if
(
is_subclass_of
(
$className
,
'yii\base\Controller'
))
{
if
(
is_subclass_of
(
$className
,
'yii\base\Controller'
))
{
return
new
$className
(
$id
,
$this
);
return
new
$className
(
$id
,
$this
);
}
elseif
(
YII_DEBUG
)
{
}
elseif
(
YII_DEBUG
)
{
...
...
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