/**
* Builds our aggregated precondition rule condition for this promotion.
* If this rule matches within all its sub conditions, then the
* whole promotion is allowed to be used.
*/
public function getPreconditionRule(): Rule
{ // we combine each topics with an AND and a OR inside of their rules.
// so all topics have to match, and one topic needs at least 1 rule that matches.
$requirements =
new AndRule( [] );
// first check if we either restrict our persona
// with direct customer assignments or with persona rules
if ($this->
isCustomerRestriction()) { // we use assigned customers
// check if we have customers.
// if so, create customer rules for it and add that also as
// a separate OR condition to our main persona rule
if ($this->
getPersonaCustomers() !== null
) {