Calling behavior method in __call

Hello!

Supposing I have a model class extended from CActiveRecord, I want to add a behavior class to this model, but when I call a behavior method in my model __call method, PHP enter in an infinite recursion, because the behavior method really don’t exists in the model class, calling again to __call.

How can I get the behavior object to call directly the behavior method?

Thanks!

Regards!

Are you overriding the __call method? can you show us some code please?

Solved!




public function __call($name, $arguments)

{

    ...

    $this->behaviorName->method(...);

    ...

}



Regards!

Ehm… not sure if that will get you some trouble lately…

The complete code is the following:


public function __call($name, $arguments)

{

	try {

		return $this->activeRelationBehavior->callRelationMethod($name, $arguments);

	} catch(ActiveRelationException $e){

		return parent::__call($name, $arguments);

	}

}

Are there trouble with that?

Regards!