original_string: 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);
  	}
code: 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);
  	}
code_tokens: 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 ) ; }
docstring: Retrieves an attribute's value or a relationship object based on the name passed. If the attribute
  accessed is 'id' then it will return the model's primary key no matter what the actual attribute name is
  for the primary key.
  
  @param string $name Name of an attribute
  @return mixed The value of the attribute
  @throws {@link UndefinedPropertyException} if name could not be resolved to an attribute, relationship, ...
docstring_tokens: Retrieves an attribute s value or a relationship object based on the name passed . If the attribute accessed is id then it will return the model s primary key no matter what the actual attribute name is for the primary key .