summaryrefslogtreecommitdiffstats
path: root/lib/Room.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-10-03 22:26:12 +0200
committerJoas Schilling <coding@schilljs.com>2022-10-04 12:10:04 +0200
commitff51959102968b16e0db4c154ea82a1f2cd218d5 (patch)
treeeb125db8d9e226795a7b575623830158a8416a76 /lib/Room.php
parent541d509f003565e1894ab8f9945b1fbf7cc81134 (diff)
Move getParticipant*() methods to participant service
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Room.php')
-rw-r--r--lib/Room.php110
1 files changed, 0 insertions, 110 deletions
diff --git a/lib/Room.php b/lib/Room.php
index 915ca78fb..9512f4c4a 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -573,116 +573,6 @@ class Room {
}
/**
- * @param string|null $sessionId
- * @return Participant
- * @throws ParticipantNotFoundException When the user is not a participant
- */
- public function getParticipantBySession(?string $sessionId): Participant {
- if (!is_string($sessionId) || $sessionId === '' || $sessionId === '0') {
- throw new ParticipantNotFoundException('Not a user');
- }
-
- $query = $this->db->getQueryBuilder();
- $helper = new SelectHelper();
- $helper->selectAttendeesTable($query);
- $helper->selectSessionsTable($query);
- $query->from('talk_sessions', 's')
- ->leftJoin('s', 'talk_attendees', 'a', $query->expr()->eq('a.id', 's.attendee_id'))
- ->where($query->expr()->eq('s.session_id', $query->createNamedParameter($sessionId)))
- ->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
- ->setMaxResults(1);
- $result = $query->executeQuery();
- $row = $result->fetch();
- $result->closeCursor();
-
- if ($row === false) {
- throw new ParticipantNotFoundException('User is not a participant');
- }
-
- return $this->manager->createParticipantObject($this, $row);
- }
-
- /**
- * @param string $pin
- * @return Participant
- * @throws ParticipantNotFoundException When the pin is not valid (has no participant assigned)
- */
- public function getParticipantByPin(string $pin): Participant {
- $query = $this->db->getQueryBuilder();
- $helper = new SelectHelper();
- $helper->selectAttendeesTable($query);
- $query->from('talk_attendees', 'a')
- ->where($query->expr()->eq('a.pin', $query->createNamedParameter($pin)))
- ->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
- ->setMaxResults(1);
- $result = $query->executeQuery();
- $row = $result->fetch();
- $result->closeCursor();
-
- if ($row === false) {
- throw new ParticipantNotFoundException('User is not a participant');
- }
-
- return $this->manager->createParticipantObject($this, $row);
- }
-
- /**
- * @param int $attendeeId
- * @return Participant
- * @throws ParticipantNotFoundException When the pin is not valid (has no participant assigned)
- */
- public function getParticipantByAttendeeId(int $attendeeId): Participant {
- $query = $this->db->getQueryBuilder();
- $helper = new SelectHelper();
- $helper->selectAttendeesTable($query);
- $query->from('talk_attendees', 'a')
- ->where($query->expr()->eq('a.id', $query->createNamedParameter($attendeeId, IQueryBuilder::PARAM_INT)))
- ->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
- ->setMaxResults(1);
-
- $result = $query->executeQuery();
- $row = $result->fetch();
- $result->closeCursor();
-
- if ($row === false) {
- throw new ParticipantNotFoundException('User is not a participant');
- }
-
- return $this->manager->createParticipantObject($this, $row);
- }
-
- /**
- * @param string $actorType
- * @param string $actorId
- * @return Participant
- * @throws ParticipantNotFoundException When the pin is not valid (has no participant assigned)
- */
- public function getParticipantByActor(string $actorType, string $actorId): Participant {
- if ($actorType === Attendee::ACTOR_USERS) {
- return $this->getParticipant($actorId, false);
- }
-
- $query = $this->db->getQueryBuilder();
- $helper = new SelectHelper();
- $helper->selectAttendeesTable($query);
- $query->from('talk_attendees', 'a')
- ->andWhere($query->expr()->eq('a.actor_type', $query->createNamedParameter($actorType)))
- ->andWhere($query->expr()->eq('a.actor_id', $query->createNamedParameter($actorId)))
- ->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
- ->setMaxResults(1);
-
- $result = $query->executeQuery();
- $row = $result->fetch();
- $result->closeCursor();
-
- if ($row === false) {
- throw new ParticipantNotFoundException('User is not a participant');
- }
-
- return $this->manager->createParticipantObject($this, $row);
- }
-
- /**
* @param string $newName Currently it is only allowed to rename: self::TYPE_GROUP, self::TYPE_PUBLIC
* @param string|null $oldName
* @return bool True when the change was valid, false otherwise