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
611052c4
Commit
611052c4
authored
Jun 29, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support preloading modules
parent
c0746f06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
Module.php
framework/yii/base/Module.php
+9
-2
No files found.
framework/yii/base/Module.php
View file @
611052c4
...
...
@@ -50,7 +50,7 @@ abstract class Module extends Component
*/
public
$params
=
array
();
/**
* @var array the IDs of the components that should be preloaded when this module is created.
* @var array the IDs of the components
or modules
that should be preloaded when this module is created.
*/
public
$preload
=
array
();
/**
...
...
@@ -556,11 +556,18 @@ abstract class Module extends Component
/**
* Loads components that are declared in [[preload]].
* @throws InvalidConfigException if a component or module to be preloaded is unknown
*/
public
function
preloadComponents
()
{
foreach
(
$this
->
preload
as
$id
)
{
$this
->
getComponent
(
$id
);
if
(
$this
->
hasComponent
(
$id
))
{
$this
->
getComponent
(
$id
);
}
elseif
(
$this
->
hasModule
(
$id
))
{
$this
->
getModule
(
$id
);
}
else
{
throw
new
InvalidConfigException
(
"Unknown component or module:
$id
"
);
}
}
}
...
...
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