Location: PHPKode > projects > Monyet > classes/servicesdef.php
<?php
Class ServicesDef Extends EntitySubject {

	private $id;
	private $name;
	private $port;
	private $description;

	public function __construct(){
		//PHYSIC TABLE DEFINITION for Service Definition
		//-----------------------------------------------------
		$tablename = 'servicesdef';
		
		$field_id = 'service_id';
		$field_name = 'name';
		$field_port = 'port';
		$field_description = 'description';
		//-----------------------------------------------------

		$rawfields = array('id'=>$field_id,'name'=>$field_name,'port'=>$field_port,'description'=>$field_description);
		$attributes = array($field_name,$field_port,$field_description);	
		parent::__construct($tablename,$field_id,$attributes,$rawfields,1);
	}
	//this is only wrapper to provide single object
	//just copy paste for all children
	public function selectByID($id){
		$tempobj = parent::selectByID($id);
		if($tempobj){
			foreach($this->rawfields as $key => $value){
				$this->$key = $tempobj->$value;
			}
		}
	}
	public function getID(){
		return $this->id;
	}
	public function getName(){
		return $this->name;
	}
	public function getPort(){
		return $this->port;
	}
	public function getDescription(){
		return $this->description;
	}
	
	//notify all observers that item is being deleted
	public function remove($id){
		parent::remove($id);
		$this->notifyObservers($id);
	}
	
	public function __destruct(){
		parent::__destruct();	
	}
}

?>
Return current item: Monyet