Skip to content

fix(Sylius): Fix media get path#121

Merged
loic425 merged 1 commit into
jolicode:mainfrom
loic425:fix/media-path
Jun 9, 2026
Merged

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

Conversation

@loic425

@loic425 loic425 commented May 15, 2026

Copy link
Copy Markdown
Contributor

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

loic425 commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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
@loic425 loic425 merged commit 1ccbb6a into jolicode:main Jun 9, 2026
6 checks passed
@loic425 loic425 deleted the fix/media-path branch June 9, 2026 08:04
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