The missing method is delegated though __call to behavioral object registered to the components.
Is it a delegation pattern or something? I’d like to learn about the more formal pattern name.
The missing method is delegated though __call to behavioral object registered to the components.
Is it a delegation pattern or something? I’d like to learn about the more formal pattern name.
See THE DEFINITIVE GUIDE TO YII: Fundamentals/Component - 3. Component Behavior.
Personnally I would not qualify behaviors as mixins, but rather as visitors (http://sourcemaking.com/design_patterns/visitor ) as the behavior is handed a reference to the visited class. A mixin would have at least have acces to protected members of the class it refers to.
PHP traits are closer to mixins than Yii’s behaviors.
It is however - IMHO - not really either.
Also, behaviors attache themselves to events which is again IMHO neither in a visitor nor a mixin.