/** * Update a room right * * @param Client $client The client to update the room right to * @param string $roomRightName The room right name * @param bool $value The new room right value * * @return bool True if the room right has been updated, false otherwise */ public function updateRoomRight(Client $client, string $roomRightName, bool $value) : bool { $roomRight = $client->getUser()->getRoomRight()->getEntityById($this->room->id); // Create the room right if it does not exist and add it to the user room right collection if ($roomRight === null) { $roomRight = new RoomRight(); $roomRight->idRoom = $this->room->id; $roomRight->idUser = $client->getUser()->id; $client->getUser()->getRoomRight()->add($roomRight); } $roomRightEntityManager = new RoomRightEntityManager($roomRight); return $roomRightEntityManager->update($roomRightName, $value); }