Skip to content

fix(Sylius): Fix media get path#121

Open
loic425 wants to merge 1 commit into
jolicode:mainfrom
loic425:fix/media-path
Open

fix(Sylius): Fix media get path#121
loic425 wants to merge 1 commit into
jolicode:mainfrom
loic425:fix/media-path

Conversation

@loic425
Copy link
Copy Markdown
Contributor

@loic425 loic425 commented May 15, 2026

I've challenged with ChatGPT but this solution seems to be the most pragmatic one.

Variante élégante

Tu pourrais aussi :

ne plus persister path à terme,
mais garder un getter virtuel via serializer/API.

Par contre ça implique :

custom hydration,
ou remplacement complet des entités.

Donc probablement overkill pour le gain réel.

Ton approche actuelle est franchement la plus pragmatique.

@loic425
Copy link
Copy Markdown
Contributor Author

loic425 commented May 22, 2026

Normally, the media path is now synchronized with the path via the ImageUploader.
But I think this PR is still relevant.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Sylius bridge to resolve image paths from the underlying Media object, aiming to fix cases where the legacy image path does not reflect the current media path.

Changes:

  • Update the Sylius admin product image helper template to read the path from image.media.path.
  • Add a getPath() method to EntityWithMediaImageTrait to return the media path when available, with a fallback to a legacy path property when present.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Bridge/Sylius/templates/admin/shared/helper/product_image.html.twig Switches admin product image URL source to image.media.path.
src/Bridge/Sylius/src/Doctrine/ORM/EntityWithMediaImageTrait.php Adds a getPath() accessor that prefers media->getPath() and falls back to legacy path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Bridge/Sylius/templates/admin/shared/helper/product_image.html.twig Outdated
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.

2 participants