<?php
require_once(DIR_FS_ADMIN.DIR_WS_CLASSES.'company.php');
class companies extends databasetable
{
	function companies(){
		$this->set_tablename(TABLE_COMPANIES);
		$this->set_index('companies_id');
		$this->related_tables = array(
			0=>array('table'=>TABLE_CUSTOMERS_TO_COMPANIES,'key'=>$this->get_index(),'class'=>'customers_to_companies' ),
			1=>array('table'=>TABLE_SHIPS_TO_COMPANIES,'key'=>$this->get_index(),'class'=>'ships_to_companies' )
		);
	}
	
	function get_company($id){
		$values = $this->get_row_by_index($id);
		$company_instance = new company( (object) current($values) );
		return $company_instance;
	}
}
