diff --git a/framework/db/ActiveRecord.php b/framework/db/ActiveRecord.php index 87d4809..16c3f77 100644 --- a/framework/db/ActiveRecord.php +++ b/framework/db/ActiveRecord.php @@ -667,7 +667,7 @@ class ActiveRecord extends Model */ public function insert($runValidation = true, $attributes = null) { - if ($runValidation && !$this->validate($attributes) && !$this->beforeSave(true)) { + if ($runValidation && !$this->validate($attributes) || !$this->beforeSave(true)) { return false; } $values = $this->getDirtyAttributes($attributes); @@ -747,7 +747,7 @@ class ActiveRecord extends Model */ public function update($runValidation = true, $attributes = null) { - if ($runValidation && !$this->validate($attributes) && !$this->beforeSave(false)) { + if ($runValidation && !$this->validate($attributes) || !$this->beforeSave(false)) { return false; } $values = $this->getDirtyAttributes($attributes);