Upgrade the ProductCategoryStorage module
Edit on GitHubThis document describes how to update the ProductCategoryStorage module.
Upgrading from version 1.* to 2.*
Version 2.* of the ProductCategoryStorage module changes the storage data structure to maintain the relation of categories to stores.
Estimated migration time: 1 hour.
To upgrade the ProductCategoryStorage module from version 1.* to 2.*:
- Upgrade the
ProductCategoryStoragemodule to version2.0.0:
composer require spryker/product-category-storage:"^2.0.0" --update-with-dependencies
-
On the project level in
Pyz/Zed/ProductCategoryStorage/Persistence/Propel/Schema/spy_product_category_storage.schema.xml, remove the synchronization behavior setup from thespy_product_abstract_category_storagetable. -
Update the database schema and the generated classes:
console propel:install
console transfer:generate
- From
Pyz\Zed\Event\EventDependencyProvider, remove the deprecated subscriber:ProductCategoryStorageEventSubscriber. - From
Pyz\EventBehavior\EventBehaviorDependencyProvider, remove the deprecated plugin:ProductCategoryEventResourceQueryContainerPlugin. - Add the new plugins:
Pyz\Zed\Publisher\PublisherDependencyProvider
<?php
namespace Pyz\Zed\Publisher;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\Category\CategoryIsActiveAndCategoryKeyWritePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\Category\CategoryStoreDeletePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\Category\CategoryStoreWriteForPublishingPublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\Category\CategoryStoreWritePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\Category\CategoryWritePublisherPlugin as ProductCategoryStorageCategoryWritePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\CategoryAttribute\CategoryAttributeNameWritePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\CategoryAttribute\CategoryAttributeWritePublisherPlugin as ProductCategoryAttributeWritePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\CategoryNode\CategoryNodeWritePublisherPlugin as ProductCategoryNodeWritePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\CategoryUrl\CategoryUrlAndResourceCategorynodeWritePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\CategoryUrl\CategoryUrlWritePublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\ProductCategory\ProductCategoryWriteForPublishingPublisherPlugin;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\ProductCategory\ProductCategoryWritePublisherPlugin;
use Spryker\Zed\Publisher\PublisherDependencyProvider as SprykerPublisherDependencyProvider;
class PublisherDependencyProvider extends SprykerPublisherDependencyProvider
{
/**
* @return array
*/
protected function getPublisherPlugins(): array
{
return array_merge(
$this->getProductCategoryStoragePlugins(),
);
}
/**
* @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface[]
*/
protected function getProductCategoryStoragePlugins(): array
{
return [
new CategoryStoreWritePublisherPlugin(),
new CategoryStoreWriteForPublishingPublisherPlugin(),
new CategoryStoreDeletePublisherPlugin(),
new ProductCategoryStorageCategoryWritePublisherPlugin(),
new CategoryIsActiveAndCategoryKeyWritePublisherPlugin(),
new ProductCategoryAttributeWritePublisherPlugin(),
new CategoryAttributeNameWritePublisherPlugin(),
new ProductCategoryNodeWritePublisherPlugin(),
new CategoryUrlWritePublisherPlugin(),
new CategoryUrlAndResourceCategorynodeWritePublisherPlugin(),
new ProductCategoryWriteForPublishingPublisherPlugin(),
new ProductCategoryWritePublisherPlugin(),
];
}
}
- Add the trigger plugin to
Pyz\Zed\Publisher\PublisherDependencyProvider:
<?php
namespace Pyz\Zed\Publisher;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Publisher\ProductCategoryPublisherTriggerPlugin;
use Spryker\Zed\Publisher\PublisherDependencyProvider as SprykerPublisherDependencyProvider;
class PublisherDependencyProvider extends SprykerPublisherDependencyProvider
{
/**
* @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherTriggerPluginInterface[]
*/
protected function getPublisherTriggerPlugins(): array
{
return [
new ProductCategoryPublisherTriggerPlugin(),
];
}
}
-
From
Pyz\Zed\Synchronization\SynchronizationDependencyProvider, remove the deprecated plugin:ProductCategorySynchronizationDataPlugin. -
Add the new synchronization plugin to
Pyz\Zed\Synchronization\SynchronizationDependencyProvider:
<?php
namespace Pyz\Zed\Synchronization;
use Spryker\Zed\ProductCategoryStorage\Communication\Plugin\Synchronization\ProductCategorySynchronizationDataBulkRepositoryPlugin;
use Spryker\Zed\Synchronization\SynchronizationDependencyProvider as SprykerSynchronizationDependencyProvider;
class SynchronizationDependencyProvider extends SprykerSynchronizationDependencyProvider
{
/**
* @return \Spryker\Zed\SynchronizationExtension\Dependency\Plugin\SynchronizationDataPluginInterface[]
*/
protected function getSynchronizationDataPlugins(): array
{
return [
new ProductCategorySynchronizationDataBulkRepositoryPlugin(),
];
}
}
-
Refill storage:
- Truncate the
spy_product_abstract_category_storagedatabase table:
TRUNCATE TABLE spy_product_abstract_category_storage;- Remove all the data:
console sync:data product_abstract_category- Trigger the event:
console publish:trigger-events -r product_abstract_category- Sync all table storage data to the storage:
console sync:data product_abstract_category - Truncate the
Ensure that the data in the spy_product_abstract_category_storage database table is divided by stores.
Thank you!
For submitting the form