Fixing issues in ContainableBehavior that could leave models unbound when 'fields' was used as part of containment conditions. Fixes #253

This commit is contained in:
mark_story 2009-11-07 17:43:18 -05:00
parent dd0c4a64c5
commit 6db91b0f49
2 changed files with 2 additions and 2 deletions

View file

@ -155,7 +155,7 @@ class ContainableBehavior extends ModelBehavior {
if (!$reset && empty($instance->__backOriginalAssociation)) {
$instance->__backOriginalAssociation = $backupBindings;
} else if ($reset) {
$instance->__backAssociation[$type] = $instance->{$type};
$instance->__backAssociation[$type] = $backupBindings[$type];
}
$instance->{$type}[$assoc] = array_merge($instance->{$type}[$assoc], $model['keep'][$assoc]);
}

View file

@ -3390,7 +3390,7 @@ class ContainableBehaviorTest extends CakeTestCase {
)
));
$this->assertEqual($expected, $this->Article->User->hasOne);
$this->Article->User->bindModel($userHasOne, false);
$expected = $this->Article->User->hasOne;
$this->Article->find('all', array(