We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44f1fef commit f432c3fCopy full SHA for f432c3f
src/Entities/User.php
@@ -40,6 +40,7 @@ class User extends Entity
40
* @var array<string, string>
41
*/
42
protected $casts = [
43
+ 'id' => 'integer',
44
'active' => 'boolean',
45
'permissions' => 'array',
46
'groups' => 'array',
src/Models/UserModel.php
@@ -298,7 +298,9 @@ protected function saveEmailIdentity(array $data): array
298
}
299
300
// Insert
301
- if ($this->tempUser->id === null) {
+ // 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) {
304
/** @var User $user */
305
$user = $this->find($this->db->insertID());
306
0 commit comments