Location: PHPKode > projects > Monyet > classes/news.php
<?php
Class News Extends EntityBase {

	private $posttime;
	private $username;
	private $title;
	private $content;

	public function __construct(){
		//PHYSIC TABLE DEFINITION for News
		//-----------------------------------------------------
		$tablename = 'news';
		
		$field_id = 'posttime';
		$field_username = 'user_id';
		$field_title = 'title';
		$field_content = 'content';
		//-----------------------------------------------------

		$rawfields = array('posttime'=>$field_id,'username'=>$field_username,'title'=>$field_title,'content'=>$field_content);
		$attributes = array($field_id,$field_username,$field_title,$field_content);
		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 getPosttime(){
		return $this->posttime;
	}

	public function getUsername(){
		return $this->username;
	}

	public function getTitle(){
		return $this->title;
	}

	public function getContent(){
		return $this->content;
	}

	public function __destruct(){
		parent::__destruct();	
	}
}

?>
Return current item: Monyet