diff --git a/src/EventListener/Doctrine/ProductListener.php b/src/EventListener/Doctrine/ProductListener.php index 5eacfda..5284cdb 100644 --- a/src/EventListener/Doctrine/ProductListener.php +++ b/src/EventListener/Doctrine/ProductListener.php @@ -55,7 +55,13 @@ private function handle(LifecycleEventArgs $eventArgs): void Assert::isInstanceOf($variant, ProductVariantInterface::class); $uploadProductVariantRequest = $variant->getPeakUploadProductVariantRequest() ?? $this->uploadProductVariantRequestFactory->createNew(); - $this->uploadProductVariantRequestWorkflow->apply($uploadProductVariantRequest, UploadProductVariantRequestWorkflow::TRANSITION_RESET); + + if ($this->uploadProductVariantRequestWorkflow->can($uploadProductVariantRequest, UploadProductVariantRequestWorkflow::TRANSITION_RESET)) { + $this->uploadProductVariantRequestWorkflow->apply( + $uploadProductVariantRequest, + UploadProductVariantRequestWorkflow::TRANSITION_RESET, + ); + } $variant->setPeakUploadProductVariantRequest($uploadProductVariantRequest); }