Started working on new Abstract for models which allows the use of multiple types of models

This commit is contained in:
Abel Hoogeveen 2015-03-16 12:38:46 +01:00
parent 5ceaa4868b
commit 453afc0b31
2 changed files with 44 additions and 0 deletions

View File

@ -5,6 +5,8 @@ return array(
'module_file' => 'class.model.php', 'module_file' => 'class.model.php',
'module_name' => 'databasemodel', 'module_name' => 'databasemodel',
'abstract' => true,
'name' => 'DatabaseModel', 'name' => 'DatabaseModel',
'description' => 'Abstract type for easy database queries', 'description' => 'Abstract type for easy database queries',
'author' => 'TechFuze', 'author' => 'TechFuze',

View File

@ -0,0 +1,42 @@
<?php
/**
* Abstract class Model
*
* Abstract for a model data representation, loads the correct parent type
*/
abstract class Model extends Bus{
/**
* The parent class holder object
* Requests get redirected to this class
* @access public
* @var Parent Object
*/
private $parentClass;
/**
* Constructs the class and Bus
* @access public
* @param Core Object, gets referenced
*/
public function __construct(&$core) {
parent::__construct($core);
}
protected function setType($type) {
}
public function __get($name) {
return $parentClass->$name;
}
public function __set($name, $value) {
$parentClass->$name = $value;
}
public function __call($name, $params) {
return call_user_func_array(array($this->parentClass, $name), $params);
}
}