Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Bridge/Sylius/src/Doctrine/ORM/EntityWithMediaImageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,19 @@ public function getMedia(): ?Media
{
return $this->media;
}

public function getPath(): ?string
{
$mediaPath = $this->media?->getPath();

if (null !== $mediaPath) {
return $mediaPath;
}

if (property_exists($this, 'path')) {
return $this->path;
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
}|merge(config) %}

{% if product.imagesByType(config.type) is not empty %}
{% set path = product.imagesByType(config.type).first.path %}
{% set path = product.imagesByType(config.type).first.media.path|default(null) %}
{% elseif product.images.first %}
{% set path = product.images.first.path %}
{% set path = product.images.first.media.path|default(null) %}
{% else %}
{% set path = null %}
{% endif %}
Expand Down
Loading