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
) { $personaCustomerOR =
new OrRule();
foreach ($this->
getPersonaCustomers()->
getElements() as $customer) { // build our new rule for this
// customer and his/her customer number
$custRule =
new CustomerNumberRule();