} public function preValidate(PreWriteValidationEvent
$event): void
{ $allowTypes =
[ ShippingMethodEntity::TAX_TYPE_FIXED,
ShippingMethodEntity::TAX_TYPE_AUTO,
ShippingMethodEntity::TAX_TYPE_HIGHEST,
];
$writeCommands =
$event->
getCommands();
foreach ($writeCommands as $command) { $violations =
new ConstraintViolationList();
if (!
$command instanceof InsertCommand && !
$command instanceof UpdateCommand
) { continue;
} if ($command->
getDefinition()->
getClass() !== ShippingMethodDefinition::
class) { continue;
}