From 7e30a677ce807831c242fc34a6d4a2a736332647 Mon Sep 17 00:00:00 2001 From: Marius Orcsik Date: Fri, 27 Feb 2009 20:06:51 +0100 Subject: [PATCH] + initial work towards a new tdo/doa abstraction on the database level --- _res/_libs/models/tdoabstract.class.php | 32 ++++++++++++++--------------- _res/_libs/models/tdoentitya.php | 19 +++++++++++++++++ _res/_libs/urlhelpers/tsurlfancy.class.php | 33 ++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 _res/_libs/models/tdoentitya.php create mode 100644 _res/_libs/urlhelpers/tsurlfancy.class.php diff --git a/_res/_libs/models/tdoabstract.class.php b/_res/_libs/models/tdoabstract.class.php index d102bc7..925c896 100644 --- a/_res/_libs/models/tdoabstract.class.php +++ b/_res/_libs/models/tdoabstract.class.php @@ -8,32 +8,30 @@ class tdoAbstract { /** - * @var interfaceSql $db + * @var interfaceSql */ - public $db, - $wheres = array(), - $groups, - $limit, - $refers = array(); + public $db; + public $wheres = array(); + public $groups; + public $limit; + public $refers = array(); /** - * @var tdoAbstractField $id + * @var tdoAbstractField */ - protected $id, - $name, - $alias, - $fields; + protected $id; + protected $name; + protected $alias; + protected $fields; /** - * @desc function to implement get_ | set_ virtual methods - * + * Function to implement get_ | set_ virtual methods * @param string $method - * @param array $args - * @return bool|mixed - * + * @param [] $args + * @return mixed * @see http://www.ibm.com/developerworks/xml/library/os-php-flexobj/ by Jack Herrington */ - function __call ( $method, $args) { + function __call ($method, $args) { $diff = $this->get_members(); $all = get_object_vars($this); diff --git a/_res/_libs/models/tdoentitya.php b/_res/_libs/models/tdoentitya.php new file mode 100644 index 0000000..c9564bb --- /dev/null +++ b/_res/_libs/models/tdoentitya.php @@ -0,0 +1,19 @@ + + * @date 09.02.26 + */ +abstract class tdoEntityA { + /** + * @return [] + */ + public function toArray (); + + /** + * @param mixed[string] $aIncArray + * @return void + */ + public function fromArray ($aIncArray); +} \ No newline at end of file diff --git a/_res/_libs/urlhelpers/tsurlfancy.class.php b/_res/_libs/urlhelpers/tsurlfancy.class.php new file mode 100644 index 0000000..94c044b --- /dev/null +++ b/_res/_libs/urlhelpers/tsurlfancy.class.php @@ -0,0 +1,33 @@ + + * @package url helpers + * @license GPL + */ +class tsUrlFancy extends tsUrlFriendly { + private $routes = array (); + + public function addRoutes ($regexRoutes = array()) { + if (!is_array($regexRoutes) || sizeof ($regexRoutes) == 0) + return false; + $this->routes = $regexRoutes; + } + + /** + * uses the regex for $controller controller to replace the subpatterns + * with array members + * + * the output is passed to the parent::setRequest method + * @see _res/_libs/urlhelpers/tsUrlFriendly#setRequest() + */ + public function setRequest ($array = array()) { + $controller = array_shift($array); + $action = array_shift($array); + + var_dump($this); + return parent::setRequest ($array); + } +} \ No newline at end of file -- 2.11.4.GIT