Commit 56c46f62 by Qiang Xue

renamed basic concept chapter names.

parent e645b837
......@@ -53,15 +53,15 @@ Handling Requests
Key Concepts
------------
* [Components](basic-components.md)
* [Properties](basic-properties.md)
* [Events](basic-events.md)
* [Behaviors](basic-behaviors.md)
* [Configurations](basic-configs.md)
* [Aliases](basic-alias.md)
* [Class Autoloading](basic-autoloading.md)
* [Service Locator](basic-service-locator.md)
* [Dependency Injection Container](basic-di-container.md)
* [Components](concept-components.md)
* [Properties](concept-properties.md)
* [Events](concept-events.md)
* [Behaviors](concept-behaviors.md)
* [Configurations](concept-configs.md)
* [Aliases](concept-aliases.md)
* [Class Autoloading](concept-autoloading.md)
* [Service Locator](concept-service-locator.md)
* [Dependency Injection Container](concept-di-container.md)
Working with Databases
......
......@@ -3,9 +3,9 @@ Configurations
Configurations are widely used in Yii for creating new objects or initializing existing objects.
They usually include the class names of the objects being created and a list of initial values
that should be assigned to object [properties](basic-properties.md). They may also include a list of
handlers that should be attached to the object [events](basic-events.md), and/or a list of
[behaviors](basic-behaviors.md) that should be attached to the objects.
that should be assigned to object [properties](concept-properties.md). They may also include a list of
handlers that should be attached to the object [events](concept-events.md), and/or a list of
[behaviors](concept-behaviors.md) that should be attached to the objects.
In the following, a configuration is used to create and initialize a DB connection:
......@@ -53,12 +53,12 @@ where
* The `class` element specifies a fully qualified class name for the object being created.
* The `propertyName` elements specify the property initial values. The keys are the property names, and the
values are the corresponding initial values. Only public member variables and [properties](basic-properties.md)
values are the corresponding initial values. Only public member variables and [properties](concept-properties.md)
defined by getters/setters can be configured.
* The `on eventName` elements specify what handlers should be attached to the object [events](basic-events.md).
* The `on eventName` elements specify what handlers should be attached to the object [events](concept-events.md).
Notice that the array keys are formed by prefixing event names with `on `. Please refer to
the [Events](basic-events.md) chapter for supported event handler formats.
* And the `as behaviorName` elements specify what [behaviors](basic-behaviors.md) should be attached to the object.
the [Events](concept-events.md) chapter for supported event handler formats.
* And the `as behaviorName` elements specify what [behaviors](concept-behaviors.md) should be attached to the object.
Notice that the array keys are formed by prefixing behavior names with `on `. `$behaviorConfig` represents
the configuration for creating a behavior, like a normal configuration as we are describing here.
......@@ -135,7 +135,7 @@ an [entry script](structure-entry-scripts.md), where the class name is already g
```
For more details about configuring the `components` property of an application can be found
in the [Applications](structure-applications.md) chapter and the [Service Locator](basic-service-locator.md) chapter.
in the [Applications](structure-applications.md) chapter and the [Service Locator](concept-service-locator.md) chapter.
### Widget Configurations
......@@ -220,7 +220,7 @@ $config = require('path/to/web.php');
Default Configurations
----------------------
The [[Yii::createObject()]] method is implemented based on a [dependency injection container](basic-di-container.md).
The [[Yii::createObject()]] method is implemented based on a [dependency injection container](concept-di-container.md).
It allows you specify a set of the so-called *default configurations* which will be applied to ANY instances of
the specified classes when they are being created using [[Yii::createObject()]]. The default configurations
can be specified by calling `Yii::$container->set()` in the [bootstrapping](runtime-bootstrapping.md) code.
......
......@@ -36,7 +36,7 @@ Yii::setAlias('@foobar', '@foo/bar');
Root aliases are usually defined during the [bootstrapping](runtime-bootstrapping.md) stage.
For example, you may call [[Yii::setAlias()]] in the [entry script](structure-entry-scripts.md).
For convenience, [Application](structure-applications.md) provides writable property named `aliases`
that you can configure in the application [configuration](basic-configs.md), like the following,
that you can configure in the application [configuration](concept-configs.md), like the following,
```php
return [
......@@ -115,7 +115,7 @@ The following is the list of the predefined aliases:
The `@yii` alias is defined when you include the `Yii.php` file in your [entry script](structure-entry-scripts.md),
while the rest of the aliases are defined in the application constructor when applying the application
[configuration](basic-configs.md).
[configuration](concept-configs.md).
Extension Aliases
......
......@@ -6,7 +6,7 @@ as [mixins](http://en.wikipedia.org/wiki/Mixin), allow you to enhance the functi
of an existing [[yii\base\Component|component]] class without the need of changing its class inheritance.
When a behavior is attached to a component, it will "inject" its methods and properties into the component,
and you can access these methods and properties as if they are defined by the component class. Moreover, a behavior
can respond to the [events](basic-events.md) triggered by the component so that it can customize or adapt the normal
can respond to the [events](concept-events.md) triggered by the component so that it can customize or adapt the normal
code execution of the component.
......@@ -18,7 +18,7 @@ attach a behavior in the next section.
Once a behavior is attached to a component, its usage is straightforward.
You can access a *public* member variable or a [property](basic-properties.md) defined by a getter and/or a setter
You can access a *public* member variable or a [property](concept-properties.md) defined by a getter and/or a setter
of the behavior through the component it is attached to, like the following,
```php
......@@ -98,7 +98,7 @@ class User extends ActiveRecord
}
```
The [[yii\base\Component::behaviors()|behaviors()]] method should return a list of behavior [configurations](basic-configs.md).
The [[yii\base\Component::behaviors()|behaviors()]] method should return a list of behavior [configurations](concept-configs.md).
Each behavior configuration can be either a behavior class name or a configuration array.
You may associate a name with a behavior by specifying the array key corresponding to the behavior configuration.
......@@ -180,7 +180,7 @@ class MyBehavior extends Behavior
The above code defines the behavior class `app\components\MyBehavior` which will provides two properties
`prop1` and `prop2`, and one method `foo()` to the component it is attached to. Note that property `prop2`
is defined via the getter `getProp2()` and the setter `setProp2()`. This is so because [[yii\base\Object]]
is an ancestor class of [[yii\base\Behavior]], which supports defining [properties](basic-properties.md) by getters/setters.
is an ancestor class of [[yii\base\Behavior]], which supports defining [properties](concept-properties.md) by getters/setters.
Within a behavior, you can access the component that the behavior is attached to through the [[yii\base\Behavior::owner]] property.
......@@ -220,7 +220,7 @@ its handler `beforeValidate()`. When specifying an event handler, you may use on
* an anonymous function.
The signature of an event handler should be as follows, where `$event` refers to the event parameter. Please refer
to the [Events](basic-events.md) chapter for more details about events.
to the [Events](concept-events.md) chapter for more details about events.
```php
function ($event) {
......
......@@ -2,8 +2,8 @@ Components
==========
Components are the main building blocks in Yii applications. Components are instances of [[yii\base\Component]]
or it child class. They support features such as [properties](basic-properties.md), [events](basic-events.md) and
[behaviors](basic-behaviors.md), which makes them more customizable and easier to use. For example, you may use
or it child class. They support features such as [properties](concept-properties.md), [events](concept-events.md) and
[behaviors](concept-behaviors.md), which makes them more customizable and easier to use. For example, you may use
the included [[yii\jui\DatePicker|date picker widget]], a user interface component, in a [view](structure-view.md)
to generate an interactive date picker:
......@@ -20,10 +20,10 @@ echo DatePicker::widget([
```
While components are very powerful, they are a bit heavier compared to normal objects, due to the fact that
it takes extra memory and CPU time in order to support [events](basic-events.md) and [behaviors](basic-behaviors.md).
it takes extra memory and CPU time in order to support [events](concept-events.md) and [behaviors](concept-behaviors.md).
If your components do not need these two features, you may consider extending your component class from
[[yii\base\Object]] instead of [[yii\base\Component]], which will make your components as efficient as normal objects,
but with the extra support for [properties](basic-properties.md).
but with the extra support for [properties](concept-properties.md).
When extending your class from [[yii\base\Component]] or [[yii\base\Object]], it is recommended that you follow
these conventions:
......@@ -61,7 +61,7 @@ class MyClass extends Object
}
```
This will make your components [configurable](basic-configs.md) when they are being created. For example,
This will make your components [configurable](concept-configs.md) when they are being created. For example,
```php
$component = new MyClass(1, 2, ['prop1' => 3, 'prop2' => 4]);
......@@ -74,7 +74,7 @@ $component = \Yii::createObject([
```
> Info: While the call of [[Yii::createObject()]] looks more complicated, it is more powerful due to
the fact that it is implemented on top of a [dependency injection container](basic-di-container.md).
the fact that it is implemented on top of a [dependency injection container](concept-di-container.md).
The [[yii\base\Object]] class enforces the following object lifecycle:
......
......@@ -331,7 +331,7 @@ Active Record Life Cycles
It is important to understand the life cycles of Active Record when it is used to manipulate data in database.
These life cycles are typically associated with corresponding events which allow you to inject code
to intercept or respond to these events. They are especially useful for developing Active Record [behaviors](basic-behaviors.md).
to intercept or respond to these events. They are especially useful for developing Active Record [behaviors](concept-behaviors.md).
When instantiating a new Active Record instance, we will have the following life cycles:
......
......@@ -54,9 +54,9 @@ Component and Object
--------------------
Yii 2.0 breaks the `CComponent` class in 1.1 into two classes: [[yii\base\Object]] and [[yii\base\Component]].
The [[yii\base\Object|Object]] class is a lightweight base class that allows defining [object properties](basic-properties.md)
The [[yii\base\Object|Object]] class is a lightweight base class that allows defining [object properties](concept-properties.md)
via getters and setters. The [[yii\base\Component|Component]] class extends from [[yii\base\Object|Object]] and supports
[events](basic-events.md) and [behaviors](basic-behaviors.md).
[events](concept-events.md) and [behaviors](concept-behaviors.md).
If your class does not need the event or behavior feature, you should consider using
[[yii\base\Object|Object]] as the base class. This is usually the case for classes that represent basic
......@@ -105,7 +105,7 @@ $object = Yii::createObject([
], [$param1, $param2]);
```
More details about configurations can be found in the [Object Configurations](basic-configs.md) chapter.
More details about configurations can be found in the [Object Configurations](concept-configs.md) chapter.
Events
......@@ -128,7 +128,7 @@ $component->on($eventName, $handler);
// $component->off($eventName, $handler);
```
There are many enhancements to the event features. For more details, please refer to the [Events](basic-events.md) chapter.
There are many enhancements to the event features. For more details, please refer to the [Events](concept-events.md) chapter.
Path Aliases
......@@ -147,7 +147,7 @@ a class like `yii\web\Request` can be autoloaded by Yii. If you use a third part
such as Zend Framework, you may define a path alias `@Zend` which refers to its installation
directory and Yii will be able to autoload any class in this library.
More on path aliases can be found in the [Path Aliases](basic-aliases.md) chapter.
More on path aliases can be found in the [Path Aliases](concept-aliases.md) chapter.
Views
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment