summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-04-18 22:06:58 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-04-18 22:06:58 +0200
commit71ac7e699f587ee479893d16521ea59570bd319f (patch)
tree0f77529c1c57fa5eb3a89937d2c04636c5e4b75f
parent5e63cd6fa56b2ab48ef048f58f8e0f5f374ac9b7 (diff)
parent3c0a4529b05ed8b3d9fadf97238e3d462d0ce733 (diff)
Merge pull request #1260 from Razican/db_ac
Added the ability to insert objects with insert_batch() in Active Record
-rw-r--r--system/database/DB_active_rec.php3
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 3 insertions, 1 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index a5df7f31a..e78b2a893 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -1252,11 +1252,12 @@ abstract class CI_DB_active_record extends CI_DB_driver {
$key = array($key => $value);
}
- $keys = array_keys(current($key));
+ $keys = array_keys($this->_object_to_array(current($key)));
sort($keys);
foreach ($key as $row)
{
+ $row = $this->_object_to_array($row);
if (count(array_diff($keys, array_keys($row))) > 0 OR count(array_diff(array_keys($row), $keys)) > 0)
{
// batch function above returns an error on an empty array
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5f6d5912c..0cac8aea0 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -54,6 +54,7 @@ Release Date: Not Released
- Database
+ - Added the ability to insert objects with insert_batch() in :doc:`Active Record <database/active_record>`.
- Added new :doc:`Active Record <database/active_record>` methods that return
the SQL string of queries without executing them: get_compiled_select(),
get_compiled_insert(), get_compiled_update(), get_compiled_delete().