how and where of my application can i decalre some general method?
For example when i use a model, it extend from CActiveRecord and i can use CActive Record property and methods in model. Now i want some where between my model and CActiveRecoed, so that i use my general methods in all of my models?
I know, I can extend a middle class extended from CActiveRecord and then the models extend from it, but i want to know if there is any solutions elss?
This only works if your implementation of behaviors is strictly hierarchical. I have behaviors which implement history logging, tagging and various other features. I need to be able to attach each of these only to the models that require them. Classical inheritance is unsuitable for this.
The difference is that you’re explicitly stating the dependencies and functionality of the class without hiding it in methods. Also, behaviors can perform actions automatically without duplicating code in each class.