foreach ($writeCommands as $command) { $violations =
new ConstraintViolationList();
if (!
$command instanceof InsertCommand && !
$command instanceof UpdateCommand
) { continue;
} if ($command->
getDefinition()->
getClass() !== ShippingMethodDefinition::
class) { continue;
} $shippingMethod =
$this->
findShippingMethod($command->
getPrimaryKey()['id'
]);
$payload =
$command->
getPayload();
/** @var string|null $taxType */
$taxType =
$this->
getValue($payload, 'tax_type',
$shippingMethod);
/** @var string|null $taxId */
$taxId =
$this->
getValue($payload, 'tax_id',
$shippingMethod);
if ($taxType && !\
in_array($taxType,
$allowTypes, true
)) { $violations->
add(