Skip to content

Commit

Permalink
Fixed where saveAttributes was overwriting the entire document on update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammaye committed Sep 18, 2013
1 parent 39940a8 commit 2e7adf2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion EMongoDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public function saveAttributes($attributes)
if(!isset($this->{$this->primaryKey()}) || $this->{$this->primaryKey()}===null)
throw new CDbException(Yii::t('yii', 'The active record cannot be updated because its _id is not set!'));

return $this->updateByPk($this->{$this->primaryKey()}, $values);
return $this->lastError=$this->updateByPk($this->{$this->primaryKey()}, array('$set'=>$values));
}
throw new CDbException(Yii::t('yii', 'The active record cannot be updated because it is new.'));
}
Expand Down

0 comments on commit 2e7adf2

Please sign in to comment.