Commit e700ca0a by Carsten Brandt

more on yii basics

parent bcfb1eaf
...@@ -5,21 +5,21 @@ Basic concepts of Yii ...@@ -5,21 +5,21 @@ Basic concepts of Yii
Component and Object Component and Object
-------------------- --------------------
Yii 2.0 breaks the `CComponent` class in 1.1 into two classes: `Object` and `Component`. Classes of the Yii framework usually extend from one of the two base classes [[Object]] and [[Component]].
The `Object` class is a lightweight base class that allows defining class properties These classes provide useful features that are added automatically to all classes extending from them.
via getters and setters. The `Component` class extends from `Object` and supports
the event feature and the behavior feature.
If your class does not need the event or behavior feature, you should consider using The `Object` class provides the [configuration and property feature](../api/base/Object.md).
`Object` as the base class. This is usually the case for classes that represent basic The `Component` class extends from `Object` and adds [event handling](events.md) and [behaviors](behaviors.md).
data structures.
`Object` is usually used for classes that represent basic data structures while `Component` is used for
application components and other classes that implement higher logic.
Object Configuration Object Configuration
-------------------- --------------------
The `Object` class introduces a uniform way of configuring objects. Any descendant class The [[Object]] class introduces a uniform way of configuring objects. Any descendant class
of `Object` should declare its constructor (if needed) in the following way so that of [[Object]] should declare its constructor (if needed) in the following way so that
it can be properly configured: it can be properly configured:
```php ```php
...@@ -57,11 +57,9 @@ $object = Yii::createObject([ ...@@ -57,11 +57,9 @@ $object = Yii::createObject([
], $param1, $param2); ], $param1, $param2);
``` ```
More on configuration in [configuration](configuration.md)
Path Alias Path Aliases
---------- ------------
Yii 2.0 expands the usage of path aliases to both file/directory paths and URLs. An alias Yii 2.0 expands the usage of path aliases to both file/directory paths and URLs. An alias
must start with a `@` character so that it can be differentiated from file/directory paths and URLs. must start with a `@` character so that it can be differentiated from file/directory paths and URLs.
......
Events Events
====== ======
TBD, see also [Component.md](../api/base/Component.md).
There is no longer the need to define an `on`-method in order to define an event in Yii 2.0. There is no longer the need to define an `on`-method in order to define an event in Yii 2.0.
Instead, you can use whatever event names. To attach a handler to an event, you should Instead, you can use whatever event names. To attach a handler to an event, you should
......
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