diff --git a/Model.php b/Model.php index b872927..a445025 100644 --- a/Model.php +++ b/Model.php @@ -8,6 +8,22 @@ class Model extends PhalconModel { + public function columnMap() + { + $columnMap = []; + $child = new static(); + $reflect = new \ReflectionObject($child); + $props = $reflect->getProperties(\ReflectionProperty::IS_PUBLIC); + foreach ($props as $prop) { + if (substr($prop->getName(), 0, 1) !== '_') { + $output = strtolower(preg_replace('/(?getName())); + $columnMap[$output] = $prop->getName(); + } + } + + return $columnMap; + } + public function permalinkFor($attribute) { $tmp = new Permalink($this->$attribute);