Skip to content

Commit

Permalink
Few improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Dec 19, 2023
1 parent 330a0b1 commit d10e37b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions src/Entity/PromotionCouponsAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@ public function getPromotionCoupons(): Collection

public function hasPromotionCoupon(PromotionCouponInterface $promotionCoupon): bool
{
foreach ($this->promotionCoupons as $currentPromotionCoupon) {
if ($currentPromotionCoupon === $promotionCoupon) {
return true;
}
}

return false;
return $this->promotionCoupons->contains($promotionCoupon);
}

public function addPromotionCoupon(PromotionCouponInterface $promotionCoupon): void
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Extension/CartTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public function validatePromotionEntry(?PromotionCouponInterface $entry, Executi
}

$context
->buildViolation('sylius.promotion_coupon.is_invalid')
->addViolation()
->buildViolation('sylius.promotion_coupon.is_invalid')
->addViolation()
;
}

Expand Down

0 comments on commit d10e37b

Please sign in to comment.