<?php
//extend subject observer
Class Group Extends EntitySubject{
private $id;
private $name;
public function __construct(){
//PHYSIC TABLE DEFINITION for Group
//-----------------------------------------------------
$tablename = 'groupdef';
$field_id = 'group_id';
$field_name = 'description';
//-----------------------------------------------------
$rawfields = array('id'=>$field_id,'name'=>$field_name);
parent::__construct($tablename,$field_id,array($field_name),$rawfields,1);
}
public function isGroupExist($groupname){
return parent::isExistByCondition($this->getField('name').'=\''.$groupname.'\'');
}
//notify all observers that item is being deleted
public function remove($id){
parent::remove($id);
parent::notifyObservers($id);
}
//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 getName(){
return $this->name;
}
public function getID(){
return $this->id;
}
public function __destruct(){
parent::__destruct();
}
}
?>