summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Ramón López <[email protected]>2014-01-02 21:34:53 +0100
committerSimon Holywell <[email protected]>2014-04-26 13:33:06 +0100
commit20bcfa0fc957cfebf45934fe5456101d2cb219f4 (patch)
tree1cef0cca21c322e12d3475c00756805759dec732
parentb185d0966bb4893098dbe5cf3d2313e6ab177d17 (diff)
Multiple column names can now be specified when calling get()
-rw-r--r--idiorm.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/idiorm.php b/idiorm.php
index 4e56569..1b9d9bb 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -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;
+ }
}
/**