public function setValue($key, $value) {
		if( !isset($key) ) {
			// Invalid key
			throw new Exception("nullKey");
			
		} else if( !in_array($key, static::$fields) ) {
			// Unknown key
			throw new FieldNotFoundException($key, static::getClass());
			
		} else if( $key === static::$IDFIELD ) {
			// ID is not editable
			throw new Exception("idNotEditable");
			
		} else if( $value !== $this->data[$key] ) {
			// The value is different
			$this->addModFields($key);
			$this->data[$key] = $value;
		}
		return $this;
	}
public function setValue($key, $value) {
		if( !isset($key) ) {
			// Invalid key
			throw new Exception("nullKey");
			
		} else if( !in_array($key, static::$fields) ) {
			// Unknown key
			throw new FieldNotFoundException($key, static::getClass());
			
		} else if( $key === static::$IDFIELD ) {
			// ID is not editable
			throw new Exception("idNotEditable");
			
		} else if( $value !== $this->data[$key] ) {
			// The value is different
			$this->addModFields($key);
			$this->data[$key] = $value;
		}
		return $this;
	}
public function setValue ( $ key , $ value ) { if ( ! isset ( $ key ) ) { // Invalid key throw new Exception ( "nullKey" ) ; } else if ( ! in_array ( $ key , static :: $ fields ) ) { // Unknown key throw new FieldNotFoundException ( $ key , static :: getClass ( ) ) ; } else if ( $ key === static :: $ IDFIELD ) { // ID is not editable throw new Exception ( "idNotEditable" ) ; } else if ( $ value !== $ this -> data [ $ key ] ) { // The value is different $ this -> addModFields ( $ key ) ; $ this -> data [ $ key ] = $ value ; } return $ this ; }
Set the value of a field

@param string $key Name of the field to set
@param mixed $value New value of the field
@return $this
@throws Exception
@throws FieldNotFoundException

Set the field $key with the new $value.
Set the value of a field