Do not use $this to call static method

This commit is contained in:
Alexander Makarov
2021-04-23 21:36:24 +03:00
parent ad2ce6ad4f
commit ffec508e58

View File

@ -1152,7 +1152,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
*/ */
public function getOldPrimaryKey($asArray = false) public function getOldPrimaryKey($asArray = false)
{ {
$keys = $this->primaryKey(); $keys = static::primaryKey();
if (empty($keys)) { 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.'); 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.');
} }