Skip to content
This repository
Browse code

Added the ability to insert objects with insert_batch() in Active Rec…

…cord.
  • Loading branch information...
commit 3c0a4529b05ed8b3d9fadf97238e3d462d0ce733 1 parent 0f22117
Iban Eguia Razican authored
3  system/database/DB_active_rec.php
@@ -1252,11 +1252,12 @@ public function set_insert_batch($key, $value = '', $escape = TRUE)
1252 1252 $key = array($key => $value);
1253 1253 }
1254 1254
1255   - $keys = array_keys(current($key));
  1255 + $keys = array_keys($this->_object_to_array(current($key)));
1256 1256 sort($keys);
1257 1257
1258 1258 foreach ($key as $row)
1259 1259 {
  1260 + $row = $this->_object_to_array($row);
1260 1261 if (count(array_diff($keys, array_keys($row))) > 0 OR count(array_diff(array_keys($row), $keys)) > 0)
1261 1262 {
1262 1263 // batch function above returns an error on an empty array
1  user_guide_src/source/changelog.rst
Source Rendered
@@ -54,6 +54,7 @@ Release Date: Not Released
54 54
55 55 - Database
56 56
  57 + - Added the ability to insert objects with insert_batch() in :doc:`Active Record <database/active_record>`.
57 58 - Added new :doc:`Active Record <database/active_record>` methods that return
58 59 the SQL string of queries without executing them: get_compiled_select(),
59 60 get_compiled_insert(), get_compiled_update(), get_compiled_delete().

0 comments on commit 3c0a452

Please sign in to comment.
Something went wrong with that request. Please try again.