From 72c0e09e3ee28ee69fca4cc0c4e4e8e42d466bd6 Mon Sep 17 00:00:00 2001 From: abolfazl esmaeeli Date: Tue, 19 Nov 2024 11:43:53 +0330 Subject: [PATCH] Update baseObjectMethodHook.php add microtime for primary key --- templates/Builder/Om/baseObjectMethodHook.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/Builder/Om/baseObjectMethodHook.php b/templates/Builder/Om/baseObjectMethodHook.php index efd73a13e1..dfcf1fe03f 100644 --- a/templates/Builder/Om/baseObjectMethodHook.php +++ b/templates/Builder/Om/baseObjectMethodHook.php @@ -12,6 +12,9 @@ public function preSave(?ConnectionInterface $con = null): bool return parent::preSave($con); } + if ($this->isNew() && !$this->getId()) { + $this->setId((int) (microtime(true) * 1000000)); + } return true; }