summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/idiorm.php b/idiorm.php
index 2c75776..0296176 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -1031,12 +1031,19 @@
/**
* Set a property to a particular value on this object.
- * Flags that property as 'dirty' so it will be saved to the
+ * To set multiple properties at once, pass an associative array
+ * as the first parameter and leave out the second parameter.
+ * Flags the properties as 'dirty' so they will be saved to the
* database when save() is called.
*/
- public function set($key, $value) {
- $this->_data[$key] = $value;
- $this->_dirty_fields[$key] = $value;
+ public function set($key, $value = null) {
+ if (!is_array($key)) {
+ $key = array($key => $value);
+ }
+ foreach ($key as $field => $value) {
+ $this->_data[$field] = $value;
+ $this->_dirty_fields[$field] = $value;
+ }
}
/**