From 0b83d0a0b01719e349e0ad51716c649fea48649d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 9 Oct 2022 21:50:56 +0200 Subject: [PATCH] Allow to unset the group of a user Fetch EAGER seems to be buggy here, so fetch the group lazily --- src/Entity/UserSystem/User.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index 888dd7c9..b651d679 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -149,7 +149,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var Group|null the group this user belongs to - * @ORM\ManyToOne(targetEntity="Group", inversedBy="users", fetch="EAGER") + * DO NOT PUT A fetch eager here! Otherwise you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions. + * @ORM\ManyToOne(targetEntity="Group", inversedBy="users") * @ORM\JoinColumn(name="group_id", referencedColumnName="id") * @Selectable() */