30 $threadMessageIds = [$this->messageId];
31 if ($this->threadBeforeMessageId)
33 $threadMessageIds = array_merge($this->threadBeforeMessageId, $threadMessageIds);
35 if ($this->threadAfterMessageId)
37 $threadMessageIds = array_merge($threadMessageIds, $this->threadAfterMessageId);
40 return $threadMessageIds;
55 $this->threadBeforeMessageId = [];
57 $query = MessageClosureTable::query()
58 ->setSelect([
'PARENT_ID'])
59 ->where(
'MESSAGE_ID', $this->messageId)
60 ->where(
'PARENT_ID',
'<', $this->messageId)
61 ->setOrder([
'PARENT_ID' =>
'ASC'])
66 $query->setLimit($limit);
69 foreach ($query->fetchAll() as $item)
71 $this->threadBeforeMessageId[] = (int)$item[
'PARENT_ID'];
77 $this->threadAfterMessageId = [];
79 $query = MessageClosureTable::query()
80 ->setSelect([
'MESSAGE_ID'])
81 ->where(
'PARENT_ID', $this->messageId)
82 ->where(
'MESSAGE_ID',
'>', $this->messageId)
83 ->setOrder([
'PARENT_ID' =>
'ASC'])
88 $query->setLimit($limit);
91 foreach ($query->fetchAll() as $item)
93 $this->threadAfterMessageId[] = (int)$item[
'MESSAGE_ID'];