getType() === self::TYPE_POST; } public function getType(): ?string { return $this->get('type'); } public function getTargetType(): ?string { return $this->get('targetType'); } public function getParentType(): ?string { return $this->get('parentType'); } public function getParentId(): ?string { return $this->get('parentId'); } public function getSuperParentType(): ?string { return $this->get('superParentType'); } public function getSuperParentId(): ?string { return $this->get('superParentId'); } public function getRelatedType(): ?string { return $this->get('relatedType'); } public function getRelatedId(): ?string { return $this->get('relatedId'); } public function getData(): stdClass { return $this->get('data') ?? (object) []; } public function isInternal(): bool { return (bool) $this->get('isInternal'); } public function getPost(): ?string { return $this->get('post'); } public function getCreatedAt(): ?DateTime { /** @var ?DateTime */ return $this->getValueObject('createdAt'); } public function setAclIsProcessed(): void { $this->aclIsProcessed = true; } public function isAclProcessed(): bool { return (bool) $this->aclIsProcessed; } public function loadAttachments(): void { $data = $this->get('data'); if (empty($data) || empty($data->attachmentsIds) || !is_array($data->attachmentsIds)) { $this->loadLinkMultipleField('attachments'); return; } if (!$this->entityManager) { throw new RuntimeException(); } $attachmentsIds = $data->attachmentsIds; $collection = $this->entityManager ->getRDBRepository('Attachment') ->select(['id', 'name', 'type']) ->order('createdAt') ->where([ 'id' => $attachmentsIds ]) ->find(); $ids = []; $names = (object) []; $types = (object) []; foreach ($collection as $e) { $id = $e->getId(); $ids[] = $id; $names->$id = $e->get('name'); $types->$id = $e->get('type'); } $this->set('attachmentsIds', $ids); $this->set('attachmentsNames', $names); $this->set('attachmentsTypes', $types); } public function addNotifiedUserId(string $userId): void { $userIdList = $this->get('notifiedUserIdList'); if (!is_array($userIdList)) { $userIdList = []; } if (!in_array($userId, $userIdList)) { $userIdList[] = $userId; } $this->set('notifiedUserIdList', $userIdList); } public function isUserIdNotified(string $userId): bool { $userIdList = $this->get('notifiedUserIdList') ?? []; return in_array($userId, $userIdList); } }