'Extend' class properties in CComponent extensions

I extended CAction (to replace CInlineAction):




class MyControllerAction extends CAction {

	function run() {

		$controller = $this->getController();

		$methodName = 'action'.$this->getId();

//		$controller->get =& $_GET; // Wooooot?

		return call_user_func_array(array($controller, $methodName), array_values($_GET));

	}

} // END Class MyControllerAction */



I extended CController to call that Action (and not CInlineAction) (but that’s not really important now):




	public function createAction($actionID) {

		if($actionID==='') {

			$actionID=$this->defaultAction;

		}

		return new MyControllerAction( $this, $actionID );

	} // END createAction() */



Yii won’t let me set $controller->get (even though that’s one of the biggest advantages of PHP!):

The million dollar question is: how can I set $controller->get by reference?

Maybe it’s smart to post the idea behind all this.

I want always all the arguments in the URL to be posted to the controller action. Obviously my MyControllerAction doesn’t do that (yet), but it’s a start. I very much don’t want all the Reflecting.

Thanks

In Yii everything extends from CComponent class. And CComponent forces you to either declare a property:




class Foo extends CComponent

{

   public $get;

}



or to write a setter method:




class Foo extends CComponent

{


   private $_get;


   public function setGet($value)

   {

      $this->_get = $value;

   }


}



In both cases you can set the property like this:




$foo = new Foo;

$foo->get = 'bar';



So in your case, you may simply extend CController like this:


public $get;

That’s not too hard =)

Thanks