diff options
author | Luis Ramón López <[email protected]> | 2014-01-02 21:34:53 +0100 |
---|---|---|
committer | Simon Holywell <[email protected]> | 2014-04-26 13:33:06 +0100 |
commit | 20bcfa0fc957cfebf45934fe5456101d2cb219f4 (patch) | |
tree | 1cef0cca21c322e12d3475c00756805759dec732 | |
parent | b185d0966bb4893098dbe5cf3d2313e6ab177d17 (diff) |
Multiple column names can now be specified when calling get()
-rw-r--r-- | idiorm.php | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1657,9 +1657,20 @@ /** * Return the value of a property of this object (database row) * or null if not present. + * + * If a column-names array is passed, it will return a associative array + * with the value of each column or null if it is not present. */ public function get($key) { - return isset($this->_data[$key]) ? $this->_data[$key] : null; + if (is_array($key)) { + $result = array(); + foreach($key as $column) { + $result[$column] = isset($this->_data[$column]) ? $this->_data[$column] : null; + } + return $result; + } else { + return isset($this->_data[$key]) ? $this->_data[$key] : null; + } } /** |