From cc09e963e8ef7ea093c7b13096856e5c732cd776 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 15 Mar 2016 22:06:47 +0100 Subject: * extending TActiveRecord so it's capable of fetching mapped column fields from sql maps --- app/php/db/ActiveRecord.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/php/db/ActiveRecord.php (limited to 'app/php/db/ActiveRecord.php') diff --git a/app/php/db/ActiveRecord.php b/app/php/db/ActiveRecord.php new file mode 100644 index 0000000..f5d06a3 --- /dev/null +++ b/app/php/db/ActiveRecord.php @@ -0,0 +1,30 @@ +_getMappedPropertyName($name); + if (property_exists($this, $name)) { + return $this->$name; + } + return parent::__get($name); + } + + public function __set($name, $value) { + $name = $this->_getMappedPropertyName($name); + if (property_exists($this, $name)) { + return $this->$name = $value; + } + return parent::__set($this->_getMappedPropertyName($name), $value); + } + +} + +?> -- cgit v1.2.3