summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIban Eguia <admin@razican.com>2012-04-15 13:30:44 +0200
committerIban Eguia <admin@razican.com>2012-04-15 13:30:44 +0200
commit3c0a4529b05ed8b3d9fadf97238e3d462d0ce733 (patch)
treebeee6bd49a9816b61faac3cda06dbaa2ac3fa41d
parent0f2211711deceb74157d6811116acc0376d3157d (diff)
Added the ability to insert objects with insert_batch() in Active Reccord.
-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().