summaryrefslogtreecommitdiff
path: root/README.markdown
diff options
context:
space:
mode:
authorDurham Hale <[email protected]>2012-08-28 22:17:02 +0100
committerDurham Hale <[email protected]>2012-08-28 22:17:02 +0100
commit4a25fa7837d5e177e2a414c5e893063169b90d7d (patch)
tree2820d87c530a7bcd795e9ff083b2d722dace07b7 /README.markdown
parent3758914a55fcdce8f7e757b763525662dde2a0a7 (diff)
parent2463ca7ace76a3b8bb9216910ca6f6d8e3f40e15 (diff)
Merge remote-tracking branch 'sandermarechal/set-array' into develop
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown8
1 files changed, 7 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown
index 9ebb1b9..cccccd3 100644
--- a/README.markdown
+++ b/README.markdown
@@ -337,7 +337,7 @@ The `as_array` method takes column names as optional arguments. If one or more o
### Updating records ###
-To update the database, change one or more of the properties of the object, then call the `save` method to commit the changes to the database. Again, you can change the values of the object's properties either by using the `set` method or by setting the value of the property directly:
+To update the database, change one or more of the properties of the object, then call the `save` method to commit the changes to the database. Again, you can change the values of the object's properties either by using the `set` method or by setting the value of the property directly. By using the `set` method it is also possible to update multiple properties at once, by passing in an associative array:
$person = ORM::for_table('person')->find_one(5);
@@ -345,6 +345,12 @@ To update the database, change one or more of the properties of the object, then
$person->set('name', 'Bob Smith');
$person->age = 20;
+ // This is equivalent to the above two assignments
+ $person->set(array(
+ 'name' => 'Bob Smith',
+ 'age' => 20,
+ ));
+
// Syncronise the object with the database
$person->save();