Skip to content

Fix: make /attachments/{attachmentId} endpoint work by adding AttachmentId to EditableAttachment and renaming attachmentIdValue to attachmentId in GetAttachmentForEditing#39966

Open
Codencode wants to merge 3 commits intoPrestaShop:9.0.xfrom
Codencode:fix/attachment-endpoint-editable-attachment
Open

Fix: make /attachments/{attachmentId} endpoint work by adding AttachmentId to EditableAttachment and renaming attachmentIdValue to attachmentId in GetAttachmentForEditing#39966
Codencode wants to merge 3 commits intoPrestaShop:9.0.xfrom
Codencode:fix/attachment-endpoint-editable-attachment

Conversation

@Codencode
Copy link
Contributor

@Codencode Codencode commented Nov 10, 2025

Add AttachmentId to EditableAttachment and rename attachmentIdValue to attachmentId in GetAttachmentForEditing (fix /attachments/{attachmentId} endpoint)

Questions Answers
Branch? 9.0.x
Description? This PR fixes and extends the handling of attachment entities to support the new /attachments/{attachmentId} API endpoint, currently being developed in PrestaShop/ps_apiresources#105.

🐛 Fixes
- Fixed the /attachments/{attachmentId} endpoint by adding the AttachmentId parameter to EditableAttachment and renaming attachmentIdValueattachmentId in GetAttachmentForEditing.
- Ensures correct mapping and retrieval of attachment data for API serialization/deserialization.

🧱 Refactors
- EditAttachmentCommand: constructor now accepts int $attachmentId instead of an AttachmentId value object, ensuring compatibility with API Platform.
- AddAttachmentCommand and EditAttachmentCommand: added setters setPathName(), setFileSize(), setMimeType(), setOriginalName() to improve flexibility when building commands from uploaded file metadata.
Type? refacto
Category? BO
BC breaks? no
Deprecations? no
How to test?
UI Tests
Fixed issue or discussion?
Related PRs PrestaShop/ps_apiresources#105
Sponsor company Codencode snc

@Codencode Codencode requested a review from a team as a code owner November 10, 2025 15:40
@Codencode Codencode added Refactoring Type: Refactoring 9.0.x Branch labels Nov 10, 2025
@github-project-automation github-project-automation bot moved this to Ready for review in PR Dashboard Nov 10, 2025
@ps-jarvis
Copy link

Hi, thanks for this contribution!

I found some issues with the Pull Request description:

Would you mind having a look at it? This will help us understand how interesting your contribution is, thank you very much!

(Note: this is an automated message, but answering it will reach a real human)

…o attachmentId in GetAttachmentForEditing (fix /attachments/{attachmentId} endpoint)
@Codencode Codencode force-pushed the fix/attachment-endpoint-editable-attachment branch from 0e6971d to 1f270fd Compare November 10, 2025 16:02
@Codencode
Copy link
Contributor Author

@tleon @nicosomb @boherm
guys, can any of you give me your opinion on these changes?
Am I on the right track to make the attachments endpoint work (PrestaShop/ps_apiresources#105) or
is there an alternative/better way?

Thanks a lot 🙏

@Codencode Codencode force-pushed the fix/attachment-endpoint-editable-attachment branch from 64bb3fc to 1b73c0e Compare November 11, 2025 12:21
…Name(), setFileSize(). setMimeType(), setOriginalName() methods
@Codencode Codencode force-pushed the fix/attachment-endpoint-editable-attachment branch from 1b73c0e to 4caf945 Compare November 11, 2025 14:12
@Codencode Codencode marked this pull request as ready for review November 12, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

9.0.x Branch Refactoring Type: Refactoring

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

2 participants