Revision #3 has been created by phazei on Aug 6, 2010, 8:25:34 AM with the memo:
Expanded on behavior example.
« previous (#2) next (#4) »
Behaviors & events
[...]So, basically, it allows you build a list of function calls that can later be executed, in the order they were added. It can save you passing around a lot of object refs and building conditional code, since you can still raise the event, even if it doesn't do anything.
Behaviors are simply a way of adding methods to an object.
In an OO language like Ruby, it's quite possible to start with an completely empty object and simply build its behavior as you go along. Yii provides this behavior with a little magic. The key is that the class you wish to add the behavior from must extend Cbehavior.
class SomeClass extends CBehavior