From 20bcfa0fc957cfebf45934fe5456101d2cb219f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Ram=C3=B3n=20L=C3=B3pez?= Date: Thu, 2 Jan 2014 21:34:53 +0100 Subject: Multiple column names can now be specified when calling get() --- idiorm.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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; + } } /** -- cgit v1.2.3