diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index c95ff26a8df..515f2e5b355 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1745,7 +1745,6 @@ public function save($data = null, $validate = true, $fieldList = array()) { if ($success && $count > 0) { if (!empty($this->data)) { - $success = $this->data; if ($created) { $this->data[$this->alias][$this->primaryKey] = $this->id; } @@ -1755,7 +1754,7 @@ public function save($data = null, $validate = true, $fieldList = array()) { $this->getEventManager()->dispatch($event); } if (!empty($this->data)) { - $success = Hash::merge($success, $this->data); + $success = $this->data; } $this->data = false; $this->_clearCache(); diff --git a/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php b/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php index b2b26b7f147..19497f7a622 100644 --- a/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php +++ b/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php @@ -888,6 +888,7 @@ public function testBehaviorSaveCallbacks() { $Sample->Behaviors->attach('Test', array('beforeSave' => 'off', 'afterSave' => 'test')); $Sample->create(); $expected = $record; + unset($expected['Sample']['name']); $result = $Sample->save($record); $expected['Sample']['id'] = $Sample->id; $this->assertSame($expected, $result); diff --git a/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php b/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php index 57f1bc3de7e..405bdb64528 100644 --- a/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php +++ b/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php @@ -213,7 +213,6 @@ public function testHabtmWithThreeDatabases() { 'Armor' => array( 'Armor' => array( 1, 2, 3, 4, - 1, 2, 3, 4, ), ), ); diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index fe8714ee9e0..d46a6db2762 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -1170,6 +1170,7 @@ public function testSaveHabtm() { $this->assertFalse(empty($result)); $result = $TestModel->save(); $this->assertFalse(empty($result)); + $this->assertEquals($data['Tag'], $result['Tag']); $TestModel->unbindModel(array('belongsTo' => array('User'), 'hasMany' => array('Comment'))); $result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));