7use Bitrix\Im\V2\Common\SidebarFilterProcessorTrait;
24 use SidebarFilterProcessorTrait;
28 return FavoriteItem::class;
31 public static function find(
40 $messageOrder = [
'ID' =>
'DESC'];
44 $messageOrder[
'ID'] =
$order[
'ID'];
47 $query = LinkFavoriteTable::query()
48 ->setSelect([
'MESSAGE',
'ID',
'CHAT_ID',
'AUTHOR_ID',
'DATE_CREATE',
'MESSAGE_ID'])
49 ->where(
'AUTHOR_ID',
$context->getUserId())
50 ->setOrder($messageOrder)
58 return static::initByEntityCollection(
$query->fetchCollection());
63 $favoriteMessageCollection =
new static();
65 foreach ($entityCollection as
$entity)
70 return $favoriteMessageCollection;
75 $entities = LinkFavoriteTable::query()
76 ->setSelect([
'ID',
'CHAT_ID',
'AUTHOR_ID',
'DATE_CREATE',
'MESSAGE_ID'])
77 ->where(
'MESSAGE_ID',
$message->getMessageId())
81 if ($entities ===
null)
86 $links = static::initByEntityCollection($entities);
88 foreach ($links as $link)
98 $entities = LinkFavoriteTable::query()
99 ->setSelect([
'ID',
'CHAT_ID',
'AUTHOR_ID',
'DATE_CREATE',
'MESSAGE_ID'])
100 ->whereIn(
'MESSAGE_ID',
$messages->getIds())
104 if ($entities ===
null)
109 $links = static::initByEntityCollection($entities);
111 foreach ($links as $link)
130 foreach ($this as $favoriteMessage)
132 $messageCollection->add($favoriteMessage->getEntity());
135 return $messageCollection;
146 $excludedList[] = ReminderPopupItem::class;
148 return $data->merge(parent::getPopupData($excludedList));
155 return parent::toRestFormat(
$option);
160 static::processSidebarFilters(
164 [
'AUTHOR_ID' =>
'MESSAGE.AUTHOR_ID',
'DATE_CREATE' =>
'MESSAGE.DATE_CREATE']
167 if (isset(
$filter[
'SEARCH_MESSAGE']))
169 $query->whereLike(
'MESSAGE.MESSAGE',
"%{$filter['SEARCH_MESSAGE']}%");
if(! $messageFields||!isset($messageFields['message_id'])||!isset($messageFields['status'])||!CModule::IncludeModule("messageservice")) $messageId
static getByMessages(MessageCollection $messages)
toRestFormat(array $option=[])
static getCollectionElementClass()
static processFilters(Query $query, array $filter, array $order)
getPopupData(array $excludedList=[])
static initByEntityCollection(EO_LinkFavorite_Collection $entityCollection)
static find(array $filter=[], array $order=['ID'=> 'DESC'], ?int $limit=null, ?Context $context=null)
static getByMessage(Message $message)
static initByEntity(EO_LinkFavorite $entity)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)