From 3ec4ecd127a71e80139e8821bca0f1df6de000ad Mon Sep 17 00:00:00 2001 From: phpnut Date: Sat, 7 Apr 2007 20:12:06 +0000 Subject: [PATCH] Adding fix for test in [4816]. This fixes hasOne association conditions git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4818 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/model/datasources/dbo_source.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index 7eeacaa15..dd47591ac 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -975,7 +975,7 @@ class DboSource extends DataSource { case 'belongsTo': if ($external) { if ($type == 'hasOne') { - $conditions = $this->__mergeConditions($queryData['conditions'], array("{$alias}.{$assocData['foreignKey']}" => '{$__cakeID__$}')); + $conditions = $this->__mergeConditions($assocData['conditions'], array("{$alias}.{$assocData['foreignKey']}" => '{$__cakeID__$}')); } elseif ($type == 'belongsTo') { $conditions = $this->__mergeConditions($assocData['conditions'], array("{$alias}.{$linkModel->primaryKey}" => '{$__cakeForeignKey__$}')); } @@ -992,9 +992,9 @@ class DboSource extends DataSource { } } else { if ($type == 'hasOne') { - $conditions = $this->__mergeConditions($queryData['conditions'], array("{$alias}.{$assocData['foreignKey']}" => '{$__cakeIdentifier[' . "{$model->name}.{$model->primaryKey}" . ']__$}')); + $conditions = $this->__mergeConditions($assocData['conditions'], array("{$alias}.{$assocData['foreignKey']}" => '{$__cakeIdentifier[' . "{$model->name}.{$model->primaryKey}" . ']__$}')); } elseif ($type == 'belongsTo') { - $conditions = $this->__mergeConditions($assocData['conditions'], array($model->escapeField($assocData['foreignKey']) => '{$__cakeIdentifier[' . "{$alias}.{$linkModel->primaryKey}" . ']__$}')); + $conditions = $this->__mergeConditions($assocData['conditions'], array("{$model->name}.{$assocData['foreignKey']}" => '{$__cakeIdentifier[' . "{$alias}.{$linkModel->primaryKey}" . ']__$}')); } $join = array('table' => $this->fullTableName($linkModel),