addType('roomId', Types::BIGINT); $this->addType('threadId', Types::BIGINT); $this->addType('attendeeId', Types::BIGINT); $this->addType('actorType', Types::STRING); $this->addType('actorId', Types::STRING); $this->addType('notificationLevel', Types::INTEGER); } public static function createFromRow(array $row): ThreadAttendee { $attendee = new ThreadAttendee(); $attendee->setRoomId((int)$row['room_id']); $attendee->setThreadId((int)$row['thread_id']); $attendee->setAttendeeId((int)$row['attendee_id']); $attendee->setNotificationLevel((int)$row['notification_level']); $attendee->setActorType($row['actor_type']); $attendee->setActorId($row['actor_id']); return $attendee; } public static function createFromParticipant(int $threadId, Participant $participant): ThreadAttendee { $attendee = new ThreadAttendee(); $attendee->setRoomId($participant->getRoom()->getId()); $attendee->setThreadId($threadId); $attendee->setAttendeeId($participant->getAttendee()->getId()); $attendee->setNotificationLevel(Participant::NOTIFY_DEFAULT); $attendee->setActorType($participant->getAttendee()->getActorType()); $attendee->setActorId($participant->getAttendee()->getActorId()); return $attendee; } /** * @return TalkThreadAttendee */ #[\Override] public function jsonSerialize(): array { return [ 'notificationLevel' => min(3, max(0, $this->getNotificationLevel())), ]; } }