Additional Behavior Methods

I have a question about Behaviors.

If I create a custom behavior B with methods B.beforeSave(), B.afterFind(), and B.someFunction(), is there a way that my model M could specifically make a call to B.someFunction()?

Is it possible to get the Behavior objects from within my model and make the call directly?

Yes. This is commonly used when two or more behaviors with the same name and different parameters are assigned to a model.




class Product extends CActiveRecord {


  function behaviors(){

    return array(

      'internalColor' => array(

        'class' => 'ext.yiiext.behaviors.model.taggable.ETaggableBehaviour',

      ),

      'externalColor' => array(

        'class' => 'ext.yiiext.behaviors.model.taggable.ETaggableBehaviour',

      ),

    );

  }


}






$product->internalColor->myBehaviorMethod();

$product->externalColor->myBehaviorMethod();



Thank you for your help.

Your answers solves my question completely.