Skip to content

Add hydration support for attachment content#19

Open
virtualLast wants to merge 3 commits into
CloudPlayDev:mainfrom
virtualLast:feature/attachment-hydration
Open

Add hydration support for attachment content#19
virtualLast wants to merge 3 commits into
CloudPlayDev:mainfrom
virtualLast:feature/attachment-hydration

Conversation

@virtualLast

@virtualLast virtualLast commented Jul 15, 2026

Copy link
Copy Markdown

Summary

Adds hydration support for Confluence attachment content.

The client already exposes attachment retrieval via:

$contentApi->children(
    $page,
    Content::CONTENT_TYPE_ATTACHMENT,
);

However, attachment results currently fail during hydration with:

HydrationException: Invalid content type: attachment

because AbstractContent::load() only supports page and comment.

Changes
Add ContentAttachment entity
Support Content::CONTENT_TYPE_ATTACHMENT in AbstractContent::load()
Add tests covering:

1. attachment hydration
2. attachment hydration within ContentSearchResult
3. Scope

This PR only adds read-only hydration support for attachment content.

It intentionally does not include:

1. attachment upload support
2. attachment download helpers
3. attachment metadata
4. API changes
5. hydrator refactoring

Fixes #18 

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Added support for loading Confluence attachments as content entities.
  * Attachments are now correctly recognized in content search results.

* **Tests**
  * Added coverage for loading attachments directly and through search results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7acfa991-6581-4f8d-a170-3e0896220620

📥 Commits

Reviewing files that changed from the base of the PR and between a43f758 and c42dd25.

📒 Files selected for processing (3)
  • src/Entity/AbstractContent.php
  • src/Entity/ContentAttachment.php
  • tests/Entity/ContentTest.php

Walkthrough

Changes

Attachment hydration

Layer / File(s) Summary
Attachment entity and loader mapping
src/Entity/ContentAttachment.php, src/Entity/AbstractContent.php
Adds ContentAttachment and maps attachment content types in AbstractContent::load(), including the expanded return contract.
Direct and search-result validation
tests/Entity/ContentTest.php
Adds shared attachment payload data and tests direct loading and loading through ContentSearchResult.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding attachment hydration support.
Linked Issues check ✅ Passed The PR matches issue #18 by adding ContentAttachment, mapping attachment hydration, and covering direct and search-result loading.
Out of Scope Changes check ✅ Passed The changes stay within attachment hydration and tests, with no unrelated functionality added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant