5use Bitrix\Im\Model\EO_LinkFavorite;
7use Bitrix\Im\V2\Common\ContextCustomer;
25 $this->initByDefault();
35 return LinkFavoriteTable::class;
55 $favoriteMessage =
new static(
$entity);
57 if (
$entity->getMessage() !==
null)
62 return $favoriteMessage;
67 $favoriteMessage =
new static();
68 $favoriteMessage->setContext($context);
72 ->setAuthorId($favoriteMessage->getContext()->getUserId())
76 return $favoriteMessage;
86 $entity = LinkFavoriteTable::query()
87 ->setSelect([
'CHAT_ID',
'AUTHOR_ID',
'DATE_CREATE',
'MESSAGE_ID'])
89 ->where(
'AUTHOR_ID', $userId)
99 return static::initByEntity(
$entity)->setEntity($message);
129 'message' => $this->
getEntity()->toRestFormat(),
146 return $data->merge(parent::getPopupData($excludedList));
setEntityId(?int $entityId)
setEntity(RestEntity $entity)
static getRestEntityName()
static getEntityClassName()
toRestFormat(array $option=[])
setMessageId(?int $messageId)
setMessageInfo(Message $message)
getPopupData(array $excludedList=[])
__construct($source=null)
static linkEntityToMessage(Entity $entity, Message $message)
static initByEntity(EO_LinkFavorite $entity)
static createFromMessage(Message $message, ?Context $context=null)
static getEntityIdFieldName()
static getByMessageAndUserId(Message $message, int $userId)