Invoke Behavior Method Through Php Magic Method __Call Dosent Work

Behavior code


class DataExportBehavior extends CBehavior 



	public $supportedTypes=array('JSON');

	public function __call($name,$parameters)



		if(preg_match('/^to(\w+)$/', $name, $matches)){

			return $this->export($matches[1]);





	public function hello(){

		return 'hello';


	public function export($type)


		if(!in_array($type, $this->supportedTypes))

			throw new CException("Type {$type} is not supported");





		return $encodedCollection;



Controller action code

public function actionIndex()


		// renders the view file 'protected/views/site/index.php'

		// using the default layout 'protected/views/layouts/main.php'

		$list=new CList;


			$obj=new stdClass;


			$obj->name='Name ' . $i;



		$dataProvider=new ArrayDataProvider($list->toArray());




Invoke the methode in the bahevior but through data provider


This throw exception that the method dosent if I test the behavior isolated works fine any ideas here? Or we cant use nested __call

Update: sorry this topic should not be here I moved it to :

Created a Pull request to add support for this: