8use Bitrix\Im\V2\Common\MigrationStatusCheckerTrait;
9use Bitrix\Im\V2\Common\SidebarFilterProcessorTrait;
22 use SidebarFilterProcessorTrait;
23 use MigrationStatusCheckerTrait;
29 return UrlItem::class;
34 if (!static::isMigrationFinished())
39 $saveResult = parent::save($isGroupSave);
40 LinkUrlIndexTable::indexInBackground();
47 $entities = \Bitrix\Im\V2\Entity\Url\UrlCollection::initByMessage($message);
49 return static::linkEntityToMessage($entities, $message);
52 public static function find(
54 array $order = [
'MESSAGE_ID' =>
'DESC'],
60 $urlOrder = [
'MESSAGE_ID' =>
'DESC'];
62 if (isset($order[
'MESSAGE_ID']))
64 $urlOrder[
'MESSAGE_ID'] = $order[
'MESSAGE_ID'];
67 $query = LinkUrlTable::query()
68 ->setSelect([
'ID',
'URL',
'DATE_CREATE',
'MESSAGE_ID',
'CHAT_ID',
'PREVIEW_URL_ID',
'AUTHOR_ID'])
73 $query->setLimit($limit);
77 $query->setOffset($offset);
79 static::processFilters($query, $filter, $urlOrder);
81 $urlCollection =
new static($query->fetchCollection());
83 return $urlCollection->fillMetadata();
90 $entities = \Bitrix\Im\V2\Entity\Url\UrlCollection::initByPreviewUrlsIds($previewUrlsIds, $withHtml);
92 foreach ($this as $url)
94 if ($entities->getById($url->getEntityId()) !==
null)
96 $url->setEntity($entities->getById($url->getEntityId()));
100 $url->setEntity((
new Entity\Url\
UrlItem())->setUrl($url->getUrl()));
109 LinkUrlTable::deleteByFilter([
'=MESSAGE_ID' => $messagesIds]);
114 LinkUrlTable::deleteByFilter([
'=CHAT_ID' => $chatsIds]);
119 LinkUrlTable::deleteByFilter([
'=AUTHOR_ID' => $authorsIds]);
124 static::processSidebarFilters($query, $filter, $order);
126 if (isset($filter[
'SEARCH_URL']))
128 $query->withSearchByUrl($filter[
'SEARCH_URL']);
save(bool $isGroupSave=false)
static deleteByChatsIds(array $chatsIds)
static getCollectionElementClass()
static processFilters(Query $query, array $filter, array $order)
static string $migrationOptionName
fillMetadata(bool $withHtml=true)
static initByMessage(Message $message)
static deleteByMessagesIds(array $messagesIds)
static find(array $filter, array $order=['MESSAGE_ID'=> 'DESC'], ?int $limit=null, ?Context $context=null, ?int $offset=null)
static deleteByAuthorsIds(array $authorsIds)