diff --git a/framework/db/BaseActiveRecord.php b/framework/db/BaseActiveRecord.php index 403979d0b9..a5fef653b3 100644 --- a/framework/db/BaseActiveRecord.php +++ b/framework/db/BaseActiveRecord.php @@ -1152,7 +1152,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface */ public function getOldPrimaryKey($asArray = false) { - $keys = $this->primaryKey(); + $keys = static::primaryKey(); if (empty($keys)) { throw new Exception(get_class($this) . ' does not have a primary key. You should either define a primary key for the corresponding table or override the primaryKey() method.'); }