i’m currently learning the yii framework and have read their documentation.
but i still don’t understand the components. what are these. they talk about component events and behaviors.
could someone explain these terms for me and give me real app examples of what a component, its events and behaviors could be?
would be helpful!
A CComponent by itself doesn’t do much. It’s very much like a QObject in Qt. A CComponent can raise events, and can have delegates to events (through attachEventHandler()).
Regarding behaviours, the manual says:
Which gives you the possibility to simulate a signals and slots mechanism, or the strategy pattern (by enabling or disabling behaviours).
Most of the classes in Yii have CComponent as a base class.
As a user, you’ll see the benefits they provide through the mechanisms mentioned above when you’ll create your own components (under protected/components/).
You can find a good starting point for implementing components here: http://www.yiiframework.com/doc/guide/basics.component