diff options
author | Jamie Matthews <[email protected]> | 2010-11-01 23:18:03 +0000 |
---|---|---|
committer | Jamie Matthews <[email protected]> | 2010-11-01 23:18:03 +0000 |
commit | e86cd738287a8e36ed1ecbcb9197fa22b851f271 (patch) | |
tree | e36fd7071a64284d1deab77c421dc713fe9f9108 /idiorm.php | |
parent | 518fee9a9b32ce7a8effc348b99d8f82690abe58 (diff) |
Add as_array method to return raw data wrapped by ORM instances
Diffstat (limited to 'idiorm.php')
-rw-r--r-- | idiorm.php | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -807,6 +807,20 @@ } /** + * Return the raw data wrapped by this ORM + * instance as an associative array. Column + * names may optionally be supplied as arguments, + * if so, only those keys will be returned. + */ + public function as_array() { + if (func_num_args() === 0) { + return $this->_data; + } + $args = func_get_args(); + return array_intersect_key($this->_data, array_flip($args)); + } + + /** * Return the value of a property of this object (database row) * or null if not present. */ |