<?php
require_once(DIR_FS_ADMIN.DIR_WS_CLASSES.'ship.php');
/**
 * ships class 
 *
 */
class ships extends databasetable
{
	/**
	 * initiates the ships class
	 *
	 */
	function ships(){
		$this->set_tablename(TABLE_SHIPS);
		$this->set_index('ships_id');
		$this->related_tables = array(
			0=>array('table'=>TABLE_SHIPS_TO_COMPANIES,'key'=>$this->get_index(),'class'=>'ships_to_companies' ),
			1=>array('table'=>TABLE_SHIP_NAMES,'key'=>'parent_id','class'=>'ship_names' )
		);
	}
	
	/**
	 * return a ship object
	 *
	 * @param integer $id
	 * @return object
	 */
	function get_ship($id){
		$values = $this->get_row_by_index($id);
		$ship_instance = new ship( (object) current($values) );
		return $ship_instance;
	}

}