summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Holywell <[email protected]>2013-12-12 10:23:43 +0000
committerSimon Holywell <[email protected]>2013-12-12 10:23:43 +0000
commit33c5012712e70f327f24d75405c6fd69131b17df (patch)
treee803f0a32c956dfc140d62e0b6fb62f8c02c1748
parent3be516b440734811b58bb9d0b458a4109b49af71 (diff)
Issue #156 findMany() returns only the last record in a set
-rw-r--r--README.markdown6
-rw-r--r--idiorm.php18
2 files changed, 7 insertions, 17 deletions
diff --git a/README.markdown b/README.markdown
index fadc25d..9c9407b 100644
--- a/README.markdown
+++ b/README.markdown
@@ -74,6 +74,12 @@ foreach ($tweets as $tweet) {
Changelog
---------
+#### 1.4.1 - release 2013-12-12
+
+**Patch update to remove a broken pull request** - may have consequences for users of 1.4.0 that exploited the "`find_many()` now returns an associative array with the databases primary ID as the array keys" change that was merged in 1.4.0.
+
+* Back out pull request/issue [#133](https://github.com/j4mie/idiorm/pull/133) as it breaks backwards compatibility in previously unexpected ways (see [#162](https://github.com/j4mie/idiorm/pull/162), [#156](https://github.com/j4mie/idiorm/issues/156) and [#133](https://github.com/j4mie/idiorm/pull/133#issuecomment-29063108) - sorry for merging this change into Idiorm as causing issues. - closes [issue 156](https://github.com/j4mie/idiorm/issues/156)
+
#### 1.4.0 - release 2013-09-05
* `find_many()` now returns an associative array with the databases primary ID as the array keys [[Surt](https://github.com/Surt)] - [issue #133](https://github.com/j4mie/idiorm/issues/133)
diff --git a/idiorm.php b/idiorm.php
index dd5cea2..7ac1652 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -611,23 +611,7 @@
*/
protected function _find_many() {
$rows = $this->_run();
- return $this->_instances_with_id_as_key($rows);
- }
-
- /**
- * Create instances of each row in the result and map
- * them to an associative array with the primary IDs as
- * the array keys.
- * @param array $rows
- * @return array
- */
- protected function _instances_with_id_as_key($rows) {
- $instances = array();
- foreach($rows as $row) {
- $row = $this->_create_instance_from_row($row);
- $instances[$row->id()] = $row;
- }
- return $instances;
+ return array_map(array($this, '_create_instance_from_row'), $rows);
}
/**