vemcogroup / laravel-sparkpost-driver

SparkPost driver to use with Laravel
MIT License
40 stars 16 forks source link

Why was the `setOptions` function removed from SparkPostTransport.php? #18

Closed markovic-nikola closed 2 years ago

markovic-nikola commented 2 years ago

Hello,

After upgrading my Laravel instances to v9 & this package to v5, there is an error when I try to set a custom config/options during the runtime.

In previous version it was working fine, I'm assigning custom metadata (object passed via API) to SparkPost for each user recipient. Something like:

$sparkPostMailDriver = app('mailer')->getSwiftMailer()->getTransport();
config(['services.sparkpost.options.metadata' => ['user_id' => $userId]]);
$sparkPostMailDriver->setOptions(config('services.sparkpost.options'));

According to Laravel upgrade docs, I changed first line due to new Symfony mailer:

$sparkPostMailDriver = app('mailer')->getSymfonyTransport();

But I'm getting an error which is breaking my website(s): Call to undefined method Vemcogroup\SparkPostDriver\Transport\SparkPostTransport::setOptions()

Is there a specific reason for removing this method?

makije commented 2 years ago

Hi @markovic-nikola

No specific reason, that I think was an oversight on my part, can you test on master?

markovic-nikola commented 2 years ago

Hi @makije

Thanks for the swift response, it works correctly, just tested it! You can tag/push it.