$value ) { $this->$key = $value; } } public function getState() { return array( "id" => $this->id, "street" => $this->street, "zip" => $this->zip, "city" => $this->city, "type" => $this->type, ); } public static function __set_state( array $state ) { $address = new RelationTestAddress(); foreach ( $state as $key => $value ) { $address->$key = $value; } return $address; } } ?>