Commit 48b53da8 by Qiang Xue

minor doc fix [skip ci]

parent e614a8fa
...@@ -61,7 +61,7 @@ class MyClass extends Object ...@@ -61,7 +61,7 @@ class MyClass extends Object
} }
``` ```
This will make your components [configurable](basic-configurations.md) when they are being created. For example, This will make your components [configurable](basic-configs.md) when they are being created. For example,
```php ```php
$component = new MyClass(1, 2, ['prop1' => 3, 'prop2' => 4]); $component = new MyClass(1, 2, ['prop1' => 3, 'prop2' => 4]);
...@@ -73,6 +73,10 @@ $component = \Yii::createObject([ ...@@ -73,6 +73,10 @@ $component = \Yii::createObject([
], [1, 2]); ], [1, 2]);
``` ```
> 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 [[yii\base\Object]] class enforces the following object lifecycle: The [[yii\base\Object]] class enforces the following object lifecycle:
1. Pre-initialization within constructor. You can set default property values here. 1. Pre-initialization within constructor. You can set default property values here.
......
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