Reputation: 21
I am new to Shopware 6 development and I am creating my first plugin at the moment. I created my custom MailService class to send mails through Shopware. Everything worked fine until I upgraded my Dockware-Dev-Image to 6.4.17.0 (previous 6.4.8.1). Now I cannot send a mail anymore, the function call ends in the following exception (also an current production systems):
" Since shopware/core : Method "Shopware\Core\Content\Flow\Dispatching\StorableFlow::Shopware\Core\Content\Flow\Dispatching\StorableFlow::setOriginalEvent()" is depr ecated and will be removed in v6.5.0.0. ["2022-11-11 12:43:20","#0 [internal function]: custom\namespace\Service\ScheduledTask\AbstractScheduledTaskHandler->custom\namespace\Service\ScheduledTask\{closure}()\n# 1 /var/www/html/vendor/symfony/deprecation-contracts/function.php(25): trigger_error()\n#2 /var/www/html/vendor/shopware/core/Framework/Feature.php(206): trigger_deprecation()\n#3 /var/www/html/vendor/shopware/core/Content/Flow/Disp atching/StorableFlow.php(70): Shopware\Core\Framework\Feature::triggerDeprecationOrThrow()\n#4 /var/www/html/vendor/shopware/core/Content/Flow/Dispatching/FlowDispatcher.php(87): Shopware\Core\Content\Flow\Dispatching\Storab leFlow->setOriginalEvent()\n#5 /var/www/html/vendor/shopware/core/Framework/Webhook/WebhookDispatcher.php(96): Shopware\Core\Content\Flow\Dispatching\FlowDispatcher->dispatch()\n#6 /var/www/html/vendor/shopware/core/Framework/E vent/BusinessEventDispatcher.php(53): Shopware\Core\Framework\Webhook\WebhookDispatcher->dispatch()\n#7 /var/www/html/vendor/shopware/core/Framework/Event/NestedEventDispatcher.php(35): Shopware\Core\Framework\Event\Business EventDispatcher->dispatch()\n#8 /var/www/html/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php(154): Shopware\Core\Framework\Event\NestedEventDispatcher->dispatch()\n#9 /var/www/html/vendor/shopware/core/Conten t/Mail/Service/MailService.php(116): Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()\n#10 /var/www/html/custom/plugins/customplugin/src/Service/CustomMailService.php(83): Shopwar e\Core\Content\Mail\Service\MailService->send() ... "
I understand the exception source and where the error is thrown etc. - I am completely fine with it.
What I do not understand is why a deprecation message does throw an exception also in a production environment. And how should I prevent this deprecation exception from throwing because I only trigger internal code, that still should work in 6.4 and is not in my hand from 6.5. Why does this block a 6.4-system from running correctly. Should that really be this way? Or should I not use the MailServer class anymore from 6.5? Do I miss something?
Thank you very much!
Upvotes: 2
Views: 302
Reputation: 13161
This should not have thrown an exception unless the feaure flag for the upcoming major release was active. Otherwise it will use trigger_deprecation
to inform developers about deprecations. If these notices are causing problems you should check your error reporting to not include types of E_USER_DEPRECATED
.
Upvotes: 1