Fixed problem with relationships that are defined soley on the 'conditions' part of the association, and not on 'foreignKey' (which is allowed to be 'false').
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@80 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -177,7 +177,8 @@ class LinkableBehavior extends ModelBehavior {
|
|||||||
$options['alias'] = $linkAlias;
|
$options['alias'] = $linkAlias;
|
||||||
$options['table'] = $Link->getDataSource()->fullTableName($Link);
|
$options['table'] = $Link->getDataSource()->fullTableName($Link);
|
||||||
$options['conditions'][] = "{$referenceLink} = {$referenceKey}";
|
$options['conditions'][] = "{$referenceLink} = {$referenceKey}";
|
||||||
} else {
|
}
|
||||||
|
elseif (isset($association['foreignKey']) && $association['foreignKey']) {
|
||||||
$foreignKey = $primaryModel->escapeField($association['foreignKey']);
|
$foreignKey = $primaryModel->escapeField($association['foreignKey']);
|
||||||
$primaryKey = $foreignModel->escapeField($foreignModel->primaryKey);
|
$primaryKey = $foreignModel->escapeField($foreignModel->primaryKey);
|
||||||
|
|
||||||
@@ -188,6 +189,10 @@ class LinkableBehavior extends ModelBehavior {
|
|||||||
else
|
else
|
||||||
$options['conditions'][] = "{$foreignKey} = {$primaryKey}";
|
$options['conditions'][] = "{$foreignKey} = {$primaryKey}";
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// No Foreign Key... nothing we can do.
|
||||||
|
$options['conditions'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
// The user may have specified conditions directly in the model
|
// The user may have specified conditions directly in the model
|
||||||
// for this join. Make sure to adhere to those conditions.
|
// for this join. Make sure to adhere to those conditions.
|
||||||
|
|||||||
Reference in New Issue
Block a user