September 26, 2011, 2:05pm
The first time I found this problem is when using Rights extension. Rights has a behavior name getName() which used in RBehavior that going to attach the user class model.
Unfortunately, some user table could be have a field named "name". And because of that it has getName(). And now Rights attach getName() behavior to the user class.
The problem is, it doesn’t throw exception. That’s why making it is so hard to debug…
September 27, 2011, 9:44am
In order to avoid such conflicts you need to specify behavior name explicitly every time you are calling a method.
September 28, 2011, 8:17am
But, what I think is, isn’t it better for Yii to throw exception when somebody is attaching an existing behavior? At least it is easier to trace error rather than silently using one of the behaviors…
That’s why I post it in the Bug Discussion. I am only using Rights as my example~
September 28, 2011, 10:54am
Attaching multiple behaviors with the same named methods is pretty valid since you can specify behavior name explicitly. Additionally it is not efficient to check all attached behaviors when calling a method without specifying behavior name.
September 28, 2011, 1:04pm
Thanks for the explanation