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
2b5819d0
Commit
2b5819d0
authored
May 29, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:yiisoft/yii2
parents
617941e0
2c8570a9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
structure-applications.md
docs/guide/structure-applications.md
+13
-12
No files found.
docs/guide/structure-applications.md
View file @
2b5819d0
...
@@ -586,6 +586,11 @@ Application components can be any objects. You can register them with an applica
...
@@ -586,6 +586,11 @@ Application components can be any objects. You can register them with an applica
globally accessible. This is usually done by configuring the
[
[yii\base\Application::components
]
] property,
globally accessible. This is usually done by configuring the
[
[yii\base\Application::components
]
] property,
as described in the
[
components
](
#components
)
subsection.
as described in the
[
components
](
#components
)
subsection.
> Info: While you can register as many application components as you want, you should do this judiciously.
Application components are like global variables. Using too many application components can potentially
make your code harder to test and maintain. In many cases, you can simply create a local component
and use it when needed.
Yii defines a set of
*core*
application components with fixed IDs and default configurations. For example,
Yii defines a set of
*core*
application components with fixed IDs and default configurations. For example,
the
[
[yii\web\Application::request|request
]
] component is used to collect information about
the
[
[yii\web\Application::request|request
]
] component is used to collect information about
a user request and resolve it into a
[
route
](
runtime-routing.md
)
; the
[
[yii\base\Application::db|db
]
]
a user request and resolve it into a
[
route
](
runtime-routing.md
)
; the
[
[yii\base\Application::db|db
]
]
...
@@ -636,20 +641,16 @@ an application will undergo the following lifecycle:
...
@@ -636,20 +641,16 @@ an application will undergo the following lifecycle:
1.
The entry script loads the application configuration as an array.
1.
The entry script loads the application configuration as an array.
2.
The entry script creates a new instance of the application:
2.
The entry script creates a new instance of the application:
*
[
[yii\base\Application::preInit()|preInit()
]
] is called, which configures some high priority
2.
1
[
[yii\base\Application::preInit()|preInit()
]
] is called, which configures some high priority
application properties, such as
[
[yii\base\Application::basePath|basePath
]
].
application properties, such as
[
[yii\base\Application::basePath|basePath
]
].
2.
2
Register the
[
[yii\base\Application::errorHandler|error handler
]
].
*
Register the
[
[yii\base\Application::errorHandler|error handler
]
].
2.
3
Configure application properties.
*
Configure application properties.
2.
4
[
[yii\base\Application::init()|init()
]
] is called which further calls
*
[
[yii\base\Application::init()|init()
]
] is called which further calls
[
[yii\base\Application::bootstrap()|bootstrap()
]
] to run bootstrap components.
[
[yii\base\Application::bootstrap()|bootstrap()
]
] to run bootstrap components.
3.
The entry script calls
[
[yii\base\Application::run()
]
] to run the application:
3.
The entry script calls
[
[yii\base\Application::run()
]
] to run the application:
*
Trigger the
[
[yii\base\Application::EVENT_BEFORE_REQUEST|EVENT_BEFORE_REQUEST
]
] event.
3.
1 Trigger the
[
[yii\base\Application::EVENT_BEFORE_REQUEST|EVENT_BEFORE_REQUEST
]
] event.
*
Handle the request: resolve the request into a
[
route
](
runtime-routing.md
)
and the associated parameters;
3.
2 Handle the request: resolve the request into a
[
route
](
runtime-routing.md
)
and the associated parameters;
create the module, controller and action objects as specified by the route; and run the action.
create the module, controller and action objects as specified by the route; and run the action.
3.
3 Trigger the
[
[yii\base\Application::EVENT_AFTER_REQUEST|EVENT_AFTER_REQUEST
]
] event.
*
Trigger the
[
[yii\base\Application::EVENT_AFTER_REQUEST|EVENT_AFTER_REQUEST
]
] event.
3.
4 Send response to the end user.
*
Send response to the end user.
4.
The entry script receives the exit status from the application and completes the request processing.
4.
The entry script receives the exit status from the application and completes the request processing.
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