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 CountablePromotionSubjectInterface:

<?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 PromotionSubjectInterface 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