avoid duplication in returned results for habtm

This commit is contained in:
Ceeram 2012-08-22 13:03:47 +02:00
parent 88604ac757
commit fb0053753e
2 changed files with 2 additions and 1 deletions

View file

@ -1755,7 +1755,7 @@ class Model extends Object implements CakeEventListener {
$this->getEventManager()->dispatch($event);
}
if (!empty($this->data)) {
$success = Hash::merge($success, $this->data);
$success = array_merge($success, $this->data);
}
$this->data = false;
$this->_clearCache();

View file

@ -1170,6 +1170,7 @@ class ModelWriteTest extends BaseModelTest {
$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)));