setId($item['id']); $post->setOwnerId($item['owner_id']); $post->setAuthorId($item['from_id']); $post->setDate($item['date']); $post->setIsRepost(); $post->setText($item['text'] ?? ''); // Переключаемся на оригинал для контента $original = $this->getOriginalPost($item); $post->setText($original['text'] ?? ''); // Вложения берем именно из оригинала if (! empty($original['attachments'])) { $attachments = $this->attachmentMapper->map($original['attachments']); $post->setAttachments($attachments); } return $post; } private function getOriginalPost(array $item): array { $copy_history_length = count($item['copy_history']); if($copy_history_length > 0) { return end($item['copy_history']); } return $item; } }