// 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
) { $personaCustomerOR =
new OrRule();
foreach ($this->
getPersonaCustomers()->
getElements() as $customer) { // build our new rule for this
// customer and his/her customer number
$custRule =
new CustomerNumberRule();
$custRule->
assign(['numbers' =>
[$customer->
getCustomerNumber()], 'operator' => CustomerNumberRule::OPERATOR_EQ
]);
$personaCustomerOR->
addRule($custRule);
} // add the rule to our main rule
$requirements->
addRule($personaCustomerOR);
} } else { // we use persona rules.
// check if we have persona rules and add them
// to our persona OR as a separate OR rule with all configured rules
if ($this->
getPersonaRules() !== null && \
count($this->
getPersonaRules()->
getElements()) > 0
) { $personaRuleOR =
new OrRule();