From 338be6719ef4be850f4d41306702af2e66ec550f Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 25 Jun 2011 09:47:06 +1000 Subject: [PATCH] Upstream Patch: ORM enhancements for PTA --- includes/kohana/modules/orm/classes/kohana/orm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/kohana/modules/orm/classes/kohana/orm.php b/includes/kohana/modules/orm/classes/kohana/orm.php index ace966a..be9a2e8 100644 --- a/includes/kohana/modules/orm/classes/kohana/orm.php +++ b/includes/kohana/modules/orm/classes/kohana/orm.php @@ -705,7 +705,7 @@ class Kohana_ORM extends Model implements serializable { } else { - foreach ($this->_has_many[$column]['foreign_key'] as $fk) + foreach ($this->_has_many[$column]['foreign_key'] as $mk => $fk) { if (isset($this->_has_many[$column]['through'])) { @@ -715,7 +715,7 @@ class Kohana_ORM extends Model implements serializable { { // Simple has_many relationship, search where target model's foreign key is this model's primary key $col = ($this->_disable_join_table_name ? '' : $model->_table_name.'.').$fk; - $val = $this->_object[$fk]; + $val = $this->_object[$mk]; } $model = $model->where($col, '=', $val);