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
54e1abaa
Commit
54e1abaa
authored
Oct 19, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better Module::init refactoring
parent
3e2bcfdf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
20 deletions
+11
-20
Application.php
framework/yii/base/Application.php
+5
-14
Module.php
framework/yii/base/Module.php
+6
-6
No files found.
framework/yii/base/Application.php
View file @
54e1abaa
...
@@ -140,6 +140,11 @@ abstract class Application extends Module
...
@@ -140,6 +140,11 @@ abstract class Application extends Module
$this
->
registerCoreComponents
();
$this
->
registerCoreComponents
();
Component
::
__construct
(
$config
);
Component
::
__construct
(
$config
);
$this
->
preloadComponents
();
if
(
$this
->
controllerNamespace
===
null
)
{
$this
->
controllerNamespace
=
'app\\controllers'
;
}
}
}
/**
/**
...
@@ -172,20 +177,6 @@ abstract class Application extends Module
...
@@ -172,20 +177,6 @@ abstract class Application extends Module
}
}
/**
/**
* Initializes the application.
* This method is called after the application is created and initialized with property values
* given in configuration.
*/
public
function
init
()
{
$this
->
preloadComponents
();
if
(
$this
->
controllerNamespace
===
null
)
{
$this
->
controllerNamespace
=
'app\\controllers'
;
}
}
/**
* Loads components that are declared in [[preload]].
* Loads components that are declared in [[preload]].
* @throws InvalidConfigException if a component or module to be preloaded is unknown
* @throws InvalidConfigException if a component or module to be preloaded is unknown
*/
*/
...
...
framework/yii/base/Module.php
View file @
54e1abaa
...
@@ -130,6 +130,12 @@ abstract class Module extends Component
...
@@ -130,6 +130,12 @@ abstract class Module extends Component
$this
->
id
=
$id
;
$this
->
id
=
$id
;
$this
->
module
=
$parent
;
$this
->
module
=
$parent
;
parent
::
__construct
(
$config
);
parent
::
__construct
(
$config
);
if
(
$this
->
controllerNamespace
===
null
)
{
$class
=
get_class
(
$this
);
if
((
$pos
=
strrpos
(
$class
,
'\\'
))
!==
false
)
{
$this
->
controllerNamespace
=
substr
(
$class
,
0
,
$pos
)
.
'\\controllers'
;
}
}
}
}
/**
/**
...
@@ -173,12 +179,6 @@ abstract class Module extends Component
...
@@ -173,12 +179,6 @@ abstract class Module extends Component
public
function
init
()
public
function
init
()
{
{
$this
->
preloadComponents
();
$this
->
preloadComponents
();
if
(
$this
->
controllerNamespace
===
null
)
{
$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