diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index e6cf47a7d..6a04e7161 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -618,9 +618,9 @@ class Model extends Overloadable { function __generateAssociation($type) { foreach ($this->{$type} as $assocKey => $assocData) { $class = $assocKey; + $dynamicWith = false; foreach ($this->__associationKeys[$type] as $key) { - $dynamicWith = false; if (!isset($this->{$type}[$assocKey][$key]) || $this->{$type}[$assocKey][$key] === null) { $data = ''; diff --git a/cake/tests/cases/libs/model/models.php b/cake/tests/cases/libs/model/models.php index 16f1538c9..74cc103c3 100644 --- a/cake/tests/cases/libs/model/models.php +++ b/cake/tests/cases/libs/model/models.php @@ -1023,6 +1023,7 @@ class Node extends CakeTestModel{ 'ParentNode' => array( 'className' => 'Node', 'joinTable' => 'dependency', + 'with' => 'Dependency', 'foreignKey' => 'child_id', 'associationForeignKey' => 'parent_id', ) @@ -2335,7 +2336,7 @@ class Content extends CakeTestModel { * @var array * @access public */ - var $hasAndBelongsToMany = array('Account' => array('className' => 'Account', 'joinTable' => 'ContentAccounts', 'foreignKey' => 'iContentId', 'associationForeignKey', 'iAccountId')); + var $hasAndBelongsToMany = array('Account' => array('className' => 'Account', 'with' => 'ContentAccount', 'joinTable' => 'ContentAccounts', 'foreignKey' => 'iContentId', 'associationForeignKey', 'iAccountId')); } /** * Nonconformant Account class