Do a extra lazy fetch on webauthn and u2f keys property of a user

In the most cases we just need the count of them and not the exact details. This just gives as a bit better performance on most requests
This commit is contained in:
Jan Böhmer 2023-07-19 00:20:38 +02:00
parent 3a8c835880
commit 87cf4c2d08

View file

@ -222,7 +222,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* @var Collection<int, UserAttachment>
*/
#[ORM\OneToMany(targetEntity: UserAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'element', targetEntity: UserAttachment::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $attachments;
@ -234,13 +234,13 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/** @var Collection<int, LegacyU2FKeyInterface>
*/
#[ORM\OneToMany(targetEntity: U2FKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'user', targetEntity: U2FKey::class, cascade: ['REMOVE'], fetch: 'EXTRA_LAZY', orphanRemoval: true)]
protected Collection $u2fKeys;
/**
* @var Collection<int, WebauthnKey>
*/
#[ORM\OneToMany(targetEntity: WebauthnKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'user', targetEntity: WebauthnKey::class, cascade: ['REMOVE'], fetch: 'EXTRA_LAZY', orphanRemoval: true)]
protected Collection $webauthn_keys;
/**