daily ideas and thoughts logged on blockchain

Behaviors in Yii

2018-06-13

Behaviors are simply a way of adding methods to an object.

In php you can not do like this

1
2
class MyBoringClass extends MySuperClass1, MySuperClass2 {
}

instead you can do like this

1
2
3
4
5
class MyBoringClass extends MySuperClass1 {

}
$classInstance = new MyBoringClass();
$classInstance->attachbehavior('uniqueName', new MySuperClass2);

The only problem is MySuperClass2 method can not overwrite method.