Skip to content

Commit

Permalink
Merge pull request #99 from acseo/fix/HasBackgroundImageValidator
Browse files Browse the repository at this point in the history
Fix HasBackgroundImageValidator
Fixes #98
  • Loading branch information
Roshyo authored Sep 9, 2020
2 parents 2d60379 + 57ad79e commit 7ce7a9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Resources/views/Shop/GiftCard/pdf.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% set path = '' %}
{% if configuration.backgroundImage is not empty %}
{% set path = configuration.backgroundImage.path|imagine_filter('setono_sylius_gift_card_background') %}
{% endif %}
Expand Down
7 changes: 6 additions & 1 deletion src/Validator/Constraints/HasBackgroundImageValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ public function validate($value, Constraint $constraint): void
}

$backgroundImage = $value->getBackgroundImage();
if (null === $backgroundImage || null === $backgroundImage->getPath()) {

if (null === $backgroundImage) {
return;
}

if (null === $backgroundImage->getFile()) {
$this->context->buildViolation($constraint->message)
->addViolation();
}
Expand Down

0 comments on commit 7ce7a9f

Please sign in to comment.