BC Method Webgriffe\SyliusActiveCampaignPlugin\Model\CustomerActiveCampaignAwareTrait#__construct() was removed
There was a bug due to a __construct method on the trait CustomerActiveCampaignAwareTrait. The constructor of the trait was never called. So that the channelCustomers property was never initialized, or it was initialized to a null value. Even if it was a null value this was then used in a foreach, and it will trigger a deprecation error. This bug has been fixed in this release. If you use the trait you can proceed in two ways:
1 - You can import the channelCustomersInitializers method and call it in the constructor of your entity. The result will be like this:
<?php
namespace App\Entity\Customer;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Customer as BaseCustomer;
use Webgriffe\SyliusActiveCampaignPlugin\Model\ActiveCampaignAwareTrait;
use Webgriffe\SyliusActiveCampaignPlugin\Model\CustomerActiveCampaignAwareInterface;
use Webgriffe\SyliusActiveCampaignPlugin\Model\CustomerActiveCampaignAwareTrait;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_customer")
*/
class Customer extends BaseCustomer implements CustomerActiveCampaignAwareInterface
{
use ActiveCampaignAwareTrait;
use CustomerActiveCampaignAwareTrait {
CustomerActiveCampaignAwareTrait::channelCustomersInitializers as private __channelCustomersInitializers;
}
public function __construct()
{
parent::__construct();
$this->__channelCustomersInitializers();
}
}2 - If you prefer you can avoid to import the channelCustomersInitializers method and initialize yourself the channelCustomers property in the constructor. The result will be like this:
<?php
namespace App\Entity\Customer;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Customer as BaseCustomer;
use Webgriffe\SyliusActiveCampaignPlugin\Model\ActiveCampaignAwareTrait;
use Webgriffe\SyliusActiveCampaignPlugin\Model\CustomerActiveCampaignAwareInterface;
use Webgriffe\SyliusActiveCampaignPlugin\Model\CustomerActiveCampaignAwareTrait;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_customer")
*/
class Customer extends BaseCustomer implements CustomerActiveCampaignAwareInterface
{
use ActiveCampaignAwareTrait;
use CustomerActiveCampaignAwareTrait;
public function __construct()
{
parent::__construct();
$this->channelCustomers = new ArrayCollection();
}
}Some services have been removed, please check if you are using them in your application and replace them:
- The
webgriffe.sylius_active_campaign_plugin.serializerservice has been removed, now we use the defaultserializer, please see #78 for more details. - Now the plugin messages use the
webgriffe_sylius_active_campaign_plugin.command_busmessenger bus with some middleware, please see #80 for more details. - The
webgriffe.sylius_active_campaign_plugin.loggerservice has been removed. Even thewebgriffe_sylius_active_campaign.logger.channel_nameparameter. Now we use a channelwebgriffe_sylius_active_campaign_pluginon monolog, please see #79 for more details.
The plugin directory structure has been updated to follow the Symfony bundle best practices.
Adjust your config/packages/webgriffe_sylius_active_campaign_plugin.yaml file by removing the word Resources:
- - { resource: "@WebgriffeSyliusActiveCampaignPlugin/Resources/config/app/config.yaml" }
+ - { resource: "@WebgriffeSyliusActiveCampaignPlugin/config/app/config.yaml" }Update your route config import file by removing the word Resources:
webgriffe_sylius_active_campaign_shop:
- resource: "@WebgriffeSyliusActiveCampaignPlugin/Resources/config/app_routing.yml"
+ resource: "@WebgriffeSyliusActiveCampaignPlugin/config/app_routing.yml"Adjust you entity following the subsequent PR notes, then remember to run a migration diff and run it with:
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrateThe messenger.default_bus is now passed to both webgriffe.sylius_active_campaign_plugin.message_handler.contact.update and webgriffe.sylius_active_campaign_plugin.message_handler.contact.create services.
- [BC] The number of required arguments for Webgriffe\SyliusActiveCampaignPlugin\MessageHandler\Contact\ContactUpdateHandler#__construct() increased from 3 to 4
- [BC] The number of required arguments for Webgriffe\SyliusActiveCampaignPlugin\MessageHandler\Contact\ContactCreateHandler#__construct() increased from 3 to 4
The listSubscriptionStatus property has been added to the ChannelCustomer entity, so two new methods (get and set) of that property, have been added to the ChannelCustomerInterface. You can use the Webgriffe\SyliusActiveCampaignPlugin\Model\ChannelActiveCampaignAwareTrait to implement these methods.
- [BC] Method getListSubscriptionStatus() was added to interface Webgriffe\SyliusActiveCampaignPlugin\Model\ChannelCustomerInterface
- [BC] Method setListSubscriptionStatus() was added to interface Webgriffe\SyliusActiveCampaignPlugin\Model\ChannelCustomerInterface
The webgriffe.sylius_active_campaign_plugin.factory.active_campaign.connection is now passed to webgriffe.sylius_active_campaign_plugin.mapper.connection service.
- [BC] The number of required arguments for Webgriffe\SyliusActiveCampaignPlugin\Mapper\ConnectionMapper#__construct() increased from 0 to 1
The get method has been added to the ActiveCampaignResourceClientInterface. A new app route has been added for a webhook.
- [BC] Method get() was added to interface Webgriffe\SyliusActiveCampaignPlugin\Client\ActiveCampaignResourceClientInterface
The FQCN is now injected in all factories.
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\ConnectionFactory#__construct() increased from 0 to 1
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\ContactFactory#__construct() increased from 0 to 1
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\ContactListFactory#__construct() increased from 0 to 1
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\ContactTagFactory#__construct() increased from 0 to 1
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\EcommerceCustomerFactory#__construct() increased from 0 to 1
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\EcommerceOrderDiscountFactory#__construct() increased from 0 to 1
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\EcommerceOrderFactory#__construct() increased from 0 to 1
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\EcommerceOrderProductFactory#__construct() increased from 0 to 1
- [BC] Webgriffe\SyliusActiveCampaignPlugin\Factory\ActiveCampaign\TagFactory#__construct() increased from 0 to 1
Use findAllToEnqueue method on ChannelsResolver to use the same method of connection exporters (#36)
The service webgriffe.sylius_active_campaign_plugin.resolver.all_enabled_channels has been replaced with the new service webgriffe.sylius_active_campaign_plugin.resolver.enqueuable_channels.
- [BC] Class Webgriffe\SyliusActiveCampaignPlugin\Resolver\AllEnabledChannelsResolver has been deleted