Migration guide - CategoryStorage
Edit on GitHubThis document describes how to update the CategoryStorage
module.
Upgrading from version 1.* to 2.*
Version 2.*
of the CategoryStorage
module changes the storage data structure to maintain the relation of categories to stores.
Estimated migration time: 1 hour.
To upgrade the module from version 1.*
to 2.*
:
- Upgrade the
CategoryStorage
module to version2.0.0
:
composer require spryker/category-storage:"^2.0.0" --update-with-dependencies
-
On the project level in
Pyz/Zed/CategoryStorage/Persistence/Propel/Schema/spy_category_storage.schema.xml
, remove the synchronization behavior setup from thespy_category_tree_storage
andspy_category_node_storage
tables. -
Update the database schema and the generated data transfer classes:
console propel:install
console transfer:generate
-
From
Pyz\Zed\Event\EventDependencyProvider
, remove the deprecated subscriber:CategoryStorageEventSubscriber
. -
From
Pyz\EventBehavior\EventBehaviorDependencyProvider
, remove the deprecated plugins:CategoryTreeEventResourceQueryContainerPlugin
CategoryNodeEventResourceQueryContainerPlugin
-
Add the new plugins:
Pyz\Zed\Publisher\PublisherDependencyProvider
<?php
namespace Pyz\Zed\Publisher;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\Category\CategoryDeletePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\Category\CategoryWritePublisherPlugin as CategoryStoreCategoryWritePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryAttribute\CategoryAttributeDeletePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryAttribute\CategoryAttributeWritePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryNode\CategoryNodeDeletePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryNode\CategoryNodeWritePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryStore\CategoryStoreWriteForPublishingPublisherPlugin as CategoryStoreStorageWriteForPublishingPublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryStore\CategoryStoreWritePublisherPlugin as CategoryStoreStorageWritePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryTemplate\CategoryTemplateDeletePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryTemplate\CategoryTemplateWritePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryTree\CategoryTreeDeletePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryTree\CategoryTreeWriteForPublishingPublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\ParentWritePublisherPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryNodePublisherTriggerPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Publisher\CategoryTreePublisherTriggerPlugin;
use Spryker\Zed\Publisher\PublisherDependencyProvider as SprykerPublisherDependencyProvider;
class PublisherDependencyProvider extends SprykerPublisherDependencyProvider
{
/**
* @return array
*/
protected function getPublisherPlugins(): array
{
return array_merge(
$this->getCategoryStoragePlugins(),
);
}
/**
* @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface[]
*/
protected function getCategoryStoragePlugins(): array
{
return [
new CategoryStoreStorageWritePublisherPlugin(),
new CategoryStoreStorageWriteForPublishingPublisherPlugin(),
new CategoryTreeWriteForPublishingPublisherPlugin(),
new CategoryDeletePublisherPlugin(),
new CategoryStoreCategoryWritePublisherPlugin(),
new CategoryAttributeDeletePublisherPlugin(),
new CategoryAttributeWritePublisherPlugin(),
new CategoryNodeDeletePublisherPlugin(),
new CategoryNodeWritePublisherPlugin(),
new CategoryTemplateDeletePublisherPlugin(),
new CategoryTemplateWritePublisherPlugin(),
new CategoryTreeDeletePublisherPlugin(),
new ParentWritePublisherPlugin(),
];
}
/**
* @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherTriggerPluginInterface[]
*/
protected function getPublisherTriggerPlugins(): array
{
return [
new CategoryNodePublisherTriggerPlugin(),
new CategoryTreePublisherTriggerPlugin(),
];
}
}
-
From
Pyz\Zed\Synchronization\SynchronizationDependencyProvider
, remove the deprecated plugins:CategoryNodeSynchronizationDataPlugin
CategoryTreeSynchronizationDataPlugin
-
Add the new synchronization plugins:
Pyz\Zed\Synchronization\SynchronizationDependencyProvider
<?php
namespace Pyz\Zed\Synchronization;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Synchronization\CategoryNodeSynchronizationDataBulkRepositoryPlugin;
use Spryker\Zed\CategoryStorage\Communication\Plugin\Synchronization\CategoryTreeSynchronizationDataBulkRepositoryPlugin;
use Spryker\Zed\Synchronization\SynchronizationDependencyProvider as SprykerSynchronizationDependencyProvider;
class SynchronizationDependencyProvider extends SprykerSynchronizationDependencyProvider
{
/**
* @return \Spryker\Zed\SynchronizationExtension\Dependency\Plugin\SynchronizationDataPluginInterface[]
*/
protected function getSynchronizationDataPlugins(): array
{
return [
new CategoryTreeSynchronizationDataBulkRepositoryPlugin(),
new CategoryNodeSynchronizationDataBulkRepositoryPlugin(),
];
}
}
-
Refill storage:
- Truncate the
spy_category_node_storage
andspy_category_tree_storage
database tables:
TRUNCATE TABLE APPROVED; TRUNCATE TABLE spy_category_tree_storage;
- Remove all the data:
console sync:data category_node console sync:data category_tree
- Trigger the events:
console publish:trigger-events -r category_node console publish:trigger-events -r category_tree
- Sync all table storage data to the storage:
console sync:data category_node console sync:data category_tree
- Truncate the
Ensure that the data in the spy_category_node_storage
and spy_category_tree_storage
database tables is divided by stores.
Thank you!
For submitting the form