Started working on new Abstract for models which allows the use of multiple types of models
This commit is contained in:
parent
5ceaa4868b
commit
453afc0b31
@ -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',
|
||||||
|
42
Core/System/class.abstract.model.php
Normal file
42
Core/System/class.abstract.model.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user