Skip to content

Latest commit

 

History

History
51 lines (29 loc) · 1.38 KB

File metadata and controls

51 lines (29 loc) · 1.38 KB
.. rst-class:: outdated

Checkers

!DANGER!

We're sorry but this documentation section is outdated. Please have that in mind when trying to use it. You can help us making documentation up to date via Sylius Github. Thank you!

ItemCountRuleChecker

You can use it when your subject implements the :ref:`component_promotion_model_promotion-countable-subject-interface`:

<?php

$itemCountChecker = new ItemCountRuleChecker();
// a Subject that implements the CountablePromotionSubjectInterface
$subject->setQuantity(3);

$configuration = array('count' => 2);

$itemCountChecker->isEligible($subject, $configuration); // returns true

ItemTotalRuleChecker

If your subject implements the :ref:`component_promotion_model_promotion-subject-interface` you can use it with this checker.

<?php

$itemTotalChecker = new ItemTotalRuleChecker();

// a Subject that implements the PromotionSubjectInterface
// Let's assume the subject->getSubjectItemTotal() returns 199

$configuration = array('amount' => 199);

$itemTotalChecker->isEligible($subject, $configuration); // returns true