From abfd2659ccb339576ec3873e0e5e3484f1271d91 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 24 Sep 2011 23:13:55 +1000 Subject: [PATCH] KH ORM updates for OSB --- includes/kohana/modules/orm/classes/kohana/orm.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/kohana/modules/orm/classes/kohana/orm.php b/includes/kohana/modules/orm/classes/kohana/orm.php index b5ef1e29..d9c164f8 100644 --- a/includes/kohana/modules/orm/classes/kohana/orm.php +++ b/includes/kohana/modules/orm/classes/kohana/orm.php @@ -688,7 +688,8 @@ class Kohana_ORM extends Model implements serializable { $join_col1 = ($this->_disable_join_table_name ? '' : $through.'.').$this->_has_many[$column]['far_key']; $join_col2 = ($this->_disable_join_table_name ? '' : $model->_table_name.'.').$model->_primary_key; - $model->join($through)->on($join_col1, '=', $join_col2); + $model->join($through)->on($join_col1, '=', $join_col2) + ->on(($this->_disable_join_table_name ? '' : $through.'.').'site_id', '=', ($this->_disable_join_table_name ? '' : $model->_table_name.'.').'site_id'); // Through table's source foreign key (foreign_key) should be this model's primary key $col = ($this->_disable_join_table_name ? '' : $through.'.').$this->_has_many[$column]['foreign_key'];