Skip to content
Browse files

Update framework/db/ar/CActiveRecord.php

method save() always returns true, even if the record does not exist in the database
  • Loading branch information...
1 parent 8afb3b5 commit 826be3950451b55e4cd13f27c1e0c34837f834c2 @s-larionov s-larionov committed Feb 1, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 framework/db/ar/CActiveRecord.php
View
4 framework/db/ar/CActiveRecord.php
@@ -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;

0 comments on commit 826be39

Please sign in to comment.
Something went wrong with that request. Please try again.