Definition at line 32 of file Conversation.php.
 
◆ __construct()
      
        
          | ILIAS\OnScreenChat\Repository\Conversation::__construct  | 
          ( | 
          private readonly ilDBInterface  | 
          $db,  | 
        
        
           | 
           | 
          protected ilObjUser  | 
          $user  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
 
◆ findByIds()
      
        
          | ILIAS\OnScreenChat\Repository\Conversation::findByIds  | 
          ( | 
          array  | 
          $conversationIds | ) | 
           | 
        
      
 
- Parameters
 - 
  
  
 
- Returns
 - ConversationDto[] 
 
Definition at line 42 of file Conversation.php.
References $res, and ILIAS\Repository\user().
   46         $res = $this->db->query(
    47             'SELECT * FROM osc_conversation WHERE ' . $this->db->in(
    55         while ($row = $this->db->fetchAssoc(
$res)) {
    56             $participants = json_decode((
string) $row[
'participants'], 
true, 512, JSON_THROW_ON_ERROR);
    57             $participantIds = array_filter(
array_map(
static function ($user): 
int {
    58                 if (is_array($user) && isset($user[
'id'])) {
    59                     return (
int) $user[
'id'];
    65             if (!in_array($this->
user->getId(), $participantIds, 
true)) {
    69             $conversation = 
new ConversationDto($row[
'id']);
    70             $conversation->setIsGroup((
bool) $row[
'is_group']);
    71             $conversation->setSubscriberUsrIds($participantIds);
    73             $inParticipants = $this->db->in(
    74                 'osc_messages.user_id',
    80             $this->db->setLimit(1, 0);
    84                 WHERE osc_messages.conversation_id = %s    86                 ORDER BY osc_messages.timestamp DESC    88             $msgRes = $this->db->queryF($query, [
'text'], [$conversation->getId()]);
    89             while ($msgRow = $this->db->fetchAssoc($msgRes)) {
    90                 $message = 
new MessageDto($msgRow[
'id'], $conversation);
    91                 $message->setMessage($msgRow[
'message']);
    92                 $message->setAuthorUsrId((
int) $msgRow[
'user_id']);
    93                 $message->setCreatedTimestamp((
int) $msgRow[
'timestamp']);
    94                 $conversation->setLastMessage($message);
    98             $conversations[] = $conversation;
   101         return $conversations;
 
 
 
 
The documentation for this class was generated from the following file: