Skip to content

Commit

Permalink
Update framework/db/ar/CActiveRecord.php
Browse files Browse the repository at this point in the history
method save() always returns true, even if the record does not exist in the database
  • Loading branch information
s-larionov committed Jan 31, 2013
1 parent 8afb3b5 commit 826be39
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion framework/db/ar/CActiveRecord.php
Expand Up @@ -1068,7 +1068,9 @@ public function update($attributes=null)
Yii::trace(get_class($this).'.update()','system.db.ar.CActiveRecord');
if($this->_pk===null)
$this->_pk=$this->getPrimaryKey();
$this->updateByPk($this->getOldPrimaryKey(),$this->getAttributes($attributes));
if (!$this->updateByPk($this->getOldPrimaryKey(),$this->getAttributes($attributes))) {
return false;
}
$this->_pk=$this->getPrimaryKey();
$this->afterSave();
return true;
Expand Down

0 comments on commit 826be39

Please sign in to comment.