Перегрузка __get() & __set()

Перегружаю функции __get() & __set() у классана наследующего класс CFormModel. мне казалось, что это выглядит примернов вот так:

function __get($nm){
		if(isset($this->$nm))


			return $this->$nm;


		if(isset($this->zones[$nm]))


			return $this->zones[$nm];


		return null;


	}


	


	function __set($nm,$val){


		if(isset($this->$nm))


			$this->$nm=$val;


		else 


			$this->zones[$nm]=$val;


		print_r($this->zones);


	}

при попытка отправить форму происходит ошибка:

Quote

session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /var/www/yii/whoisserver/protected/extensions/WhoisServer/models/CheckDomainForm.php:17)

не понимаю как это связанно. Кто-нить сможет обьяснить как правильно перегрузить функции __get() и __set()? Заранее спасибо

ЗЫ

Приложил файл моего контроллера и модели. Может они помогут. Заранее спасибо

Ну вообще-то можно было бы посмотреть в родительский класс, как это там реализовано:

class CComponent


{


	private $_e;


	private $_m;





	/**


	 * Returns a property value, an event handler list or a behavior based on its name.


	 * Do not call this method. This is a PHP magic method that we override


	 * to allow using the following syntax to read a property or obtain event handlers:


	 * <pre>


	 * $value=$component->propertyName;


	 * $handlers=$component->eventName;


	 * </pre>


	 * @param string the property name or event name


	 * @return mixed the property value, event handlers attached to the event, or the named behavior (since version 1.0.2)


	 * @throws CException if the property or event is not defined


	 * @see __set


	 */


	public function __get($name)


	{


		$getter='get'.$name;


		if(method_exists($this,$getter))


			return $this->$getter();


		else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))


		{


			// duplicating getEventHandlers() here for performance


			$name=strtolower($name);


			if(!isset($this->_e[$name]))


				$this->_e[$name]=new CList;


			return $this->_e[$name];


		}


		else if(isset($this->_m[$name]))


			return $this->_m[$name];


		else


			throw new CException(Yii::t('yii','Property "{class}.{property}" is not defined.',


				array('{class}'=>get_class($this), '{property}'=>$name)));


	}





	/**


	 * Sets value of a component property.


	 * Do not call this method. This is a PHP magic method that we override


	 * to allow using the following syntax to set a property or attach an event handler


	 * <pre>


	 * $this->propertyName=$value;


	 * $this->eventName=$callback;


	 * </pre>


	 * @param string the property name or the event name


	 * @param mixed the property value or callback


	 * @throws CException if the property/event is not defined or the property is read only.


	 * @see __get


	 */


	public function __set($name,$value)


	{


		$setter='set'.$name;


		if(method_exists($this,$setter))


			$this->$setter($value);


		else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))


		{


			// duplicating getEventHandlers() here for performance


			$name=strtolower($name);


			if(!isset($this->_e[$name]))


				$this->_e[$name]=new CList;


			$this->_e[$name]->add($value);


		}


		else if(method_exists($this,'get'.$name))


			throw new CException(Yii::t('yii','Property "{class}.{property}" is read only.',


				array('{class}'=>get_class($this), '{property}'=>$name)));


		else


			throw new CException(Yii::t('yii','Property "{class}.{property}" is not defined.',


				array('{class}'=>get_class($this), '{property}'=>$name)));


	}


.....


}

Если перегружать так, как этот делаешь ты, то теряется куча функционала компонента.

Ошибка проиходит потому, что если ВНИМАТЕЛЬНО посмотреть на строку 17, то увидим:

print_r($this->zones);

Тебе, вообще-то, об этом и пишут - вывод начат на строке 17. Закомментируй и будет тебе счастье.

А вообще-то таким подходом ты убиваешь идею фреймворка - практически весь удобный функционал компонента. Подумай, может можно как-то обойтись без этого?

хорошо. спасибо большое. подумаю как по другому можно сделать