public function &readAttribute($name)
	{
		// check for aliased attribute
		if (array_key_exists($name, static::$aliasAttribute))
			$name = static::$aliasAttribute[$name];

		// check for attribute
		if (array_key_exists($name,$this->_attributes))
			return $this->_attributes[$name];

		// check relationships if no attribute
		if (array_key_exists($name,$this->_relationships))
			return $this->_relationships[$name];

		$table = static::table();

		// this may be first access to the relationship so check Table
		if (($relationship = $table->getRelationship($name))) {
			$this->_relationships[$name] = $relationship->load($this);
			return $this->_relationships[$name];
		}

		// Shortcut to get primary key
		if ($name == 'id') {
			$pk = $this->getPrimaryKey(true);
			if (isset($this->_attributes[$pk])) return $this->_attributes[$pk];
		}

		//do not remove - have to return null by reference in strict mode
		$null = null;
		foreach (static::$delegate as &$item) {
			if (($delegated_name = $this->isDelegated($name, $item))) {
				$to = $item['to'];
				if ($this->$to) {
					$val =& $this->$to->__get($delegated_name);
					return $val;
				} else {
					return $null;
				}
			}
		}

		throw new UndefinedPropertyException(get_called_class(),$name);
	}