This commit is contained in:
xl
2024-09-05 15:42:24 +08:00
parent 5a6f6da70a
commit 96ae59248d
+2 -2
View File
@@ -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;
}