Definition at line 32 of file Conversation.php.
◆ __construct()
◆ findByIds()
ILIAS\OnScreenChat\Repository\Conversation::findByIds |
( |
array |
$conversationIds | ) |
|
- Parameters
-
- Returns
- ConversationDto[]
Definition at line 47 of file Conversation.php.
References $message, $query, $res, and ILIAS\Repository\user().
51 $res = $this->db->query(
52 'SELECT * FROM osc_conversation WHERE ' . $this->db->in(
60 while ($row = $this->db->fetchAssoc(
$res)) {
61 $participants = json_decode($row[
'participants'],
true, 512, JSON_THROW_ON_ERROR);
62 $participantIds = array_filter(array_map(
static function (
$user):
int {
64 return (
int)
$user[
'id'];
70 if (!in_array($this->
user->getId(), $participantIds,
true)) {
74 $conversation =
new ConversationDto($row[
'id']);
75 $conversation->setIsGroup((
bool) $row[
'is_group']);
76 $conversation->setSubscriberUsrIds($participantIds);
78 $inParticipants = $this->db->in(
79 'osc_messages.user_id',
85 $this->db->setLimit(1, 0);
89 WHERE osc_messages.conversation_id = %s 91 ORDER BY osc_messages.timestamp DESC 93 $msgRes = $this->db->queryF(
$query, [
'text'], [$conversation->getId()]);
94 while ($msgRow = $this->db->fetchAssoc($msgRes)) {
95 $message =
new MessageDto($msgRow[
'id'], $conversation);
96 $message->setMessage($msgRow[
'message']);
97 $message->setAuthorUsrId((
int) $msgRow[
'user_id']);
98 $message->setCreatedTimestamp((
int) $msgRow[
'timestamp']);
99 $conversation->setLastMessage(
$message);
103 $conversations[] = $conversation;
106 return $conversations;
◆ $db
◆ $user
ilObjUser ILIAS\OnScreenChat\Repository\Conversation::$user |
|
protected |
The documentation for this class was generated from the following file: