Skip to content

Commit f1894c9

Browse files
committed
fix: make User::$id nullable
1 parent 3e25ecc commit f1894c9

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Entities/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class User extends Entity
4040
* @var array<string, string>
4141
*/
4242
protected $casts = [
43-
'id' => 'integer',
43+
'id' => '?integer',
4444
'active' => 'boolean',
4545
'permissions' => 'array',
4646
'groups' => 'array',

src/Models/UserModel.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,7 @@ protected function saveEmailIdentity(array $data): array
298298
}
299299

300300
// Insert
301-
// If we use Entity Property Casting ['id' => 'integer'],
302-
// `id` returns 0 when not set.
303-
if ($this->tempUser->id === null || $this->tempUser->id === 0) {
301+
if ($this->tempUser->id === null) {
304302
/** @var User $user */
305303
$user = $this->find($this->db->insertID());
306304

0 commit comments

Comments
 (0)