diff --git a/Base/Model.php b/Base/Model.php index 1467a02..9c5801a 100644 --- a/Base/Model.php +++ b/Base/Model.php @@ -223,8 +223,8 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \ */ public function getPrimaryValue(): ?int { - if ($this->hasPrimary()) { - return (int)$this->_oldAttributes[$this->getPrimary()] ?? null; + if ($this->hasPrimary() && isset($this->_oldAttributes[$this->getPrimary()])) { + return (int)$this->_oldAttributes[$this->getPrimary()]; } else { return null; }