Upgrade the CategoryPageSearch module
Edit on GitHubThis document describes how to upgrade the CategoryPageSearch
module.
Upgrading from version 1.* to 2.*
This section describes how to upgrade the CategoryPageSearch
from version 1.*
to 2.*
.
Version 2.* of the CategoryPageSearch
module changes the storage data structure to maintain the relations of categories to stores.
Estimated migration time: 1 hour.
To upgrade to the new version of the module, do the following:
- Install the
ProductCategorySearch
module:
composer require spryker/product-category-search
- Upgrade the
CategoryPageSearch
module to version2.0.0
:
composer require spryker/category-page-search:"^2.0.0" --update-with-dependencies
-
From the
spy_category_node_page_search
table on the project level inPyz/Zed/CategoryPageSearch/Persistence/Propel/Schema/spy_category_page_search.schema.xml
, remove the synchronization behavior setup. -
Update the database schema and the generated classes:
console propel:install
console transfer:generate
- In the
CategoryPageSearch
module, replace the deprecated plugins:
ProductCategoryPageDataLoaderExpanderPlugin
CategoryPageDataLoaderPlugin
ProductCategoryMapExpanderPlugin
Pyz/Zed/ProductPageSearch/ProductPageSearchDependencyProvider
<?php
namespace Pyz\Zed\ProductPageSearch;
use Spryker\Zed\ProductCategorySearch\Communication\Plugin\ProductPageSearch\Elasticsearch\ProductCategoryMapExpanderPlugin;
use Spryker\Zed\ProductCategorySearch\Communication\Plugin\ProductPageSearch\ProductCategoryPageDataExpanderPlugin;
use Spryker\Zed\ProductCategorySearch\Communication\Plugin\ProductPageSearch\ProductCategoryPageDataLoaderPlugin;
use Spryker\Zed\ProductPageSearch\ProductPageSearchDependencyProvider as SprykerProductPageSearchDependencyProvider;
class ProductPageSearchDependencyProvider extends SprykerProductPageSearchDependencyProvider
{
/**
* @return \Spryker\Zed\ProductPageSearch\Dependency\Plugin\ProductPageDataExpanderInterface[]
*/
protected function getDataExpanderPlugins()
{
$dataExpanderPlugins = [];
$dataExpanderPlugins[ProductPageSearchConfig::PLUGIN_PRODUCT_CATEGORY_PAGE_DATA] = new ProductCategoryPageDataExpanderPlugin();
return $dataExpanderPlugins;
}
/**
* @return \Spryker\Zed\ProductPageSearchExtension\Dependency\Plugin\ProductAbstractMapExpanderPluginInterface[]
*/
protected function getProductAbstractMapExpanderPlugins(): array
{
return [
new ProductCategoryMapExpanderPlugin(),
];
}
/**
* @return \Spryker\Zed\ProductPageSearchExtension\Dependency\Plugin\ProductPageDataLoaderPluginInterface[]
*/
protected function getDataLoaderPlugins()
{
return [
new ProductCategoryPageDataLoaderPlugin(),
];
}
}
-
From
Pyz\Zed\Event\EventDependencyProvider
, remove the deprecated subscriber:CategoryPageSearchEventSubscriber
. -
From
Pyz\EventBehavior\EventBehaviorDependencyProvider
, remove the deprecated plugin:CategoryPageEventResourceQueryContainerPlugin
. -
Add the new plugins:
Pyz\Zed\Publisher\PublisherDependencyProvider
<?php
namespace Pyz\Zed\Publisher;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\Category\CategoryDeletePublisherPlugin as CategoryPageSearchCategoryDeletePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\Category\CategoryWritePublisherPlugin as CategoryPageSearchCategoryWritePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryAttribute\CategoryAttributeDeletePublisherPlugin as CategoryPageSearchCategoryAttributeDeletePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryAttribute\CategoryAttributeWritePublisherPlugin as CategoryPageSearchCategoryAttributeWritePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryNode\CategoryNodeDeletePublisherPlugin as CategoryPageSearchCategoryNodeDeletePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryNode\CategoryNodeWritePublisherPlugin as CategoryPageSearchCategoryNodeWritePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryStore\CategoryStoreWriteForPublishingPublisherPlugin as CategoryStoreSearchWriteForPublishingPublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryStore\CategoryStoreWritePublisherPlugin as CategoryStoreSearchWritePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryTemplate\CategoryTemplateDeletePublisherPlugin as CategoryPageSearchCategoryTemplateDeletePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryTemplate\CategoryTemplateWritePublisherPlugin as CategoryPageSearchCategoryTemplateWritePublisherPlugin;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Publisher\CategoryPagePublisherTriggerPlugin;
use Spryker\Zed\Publisher\PublisherDependencyProvider as SprykerPublisherDependencyProvider;
class PublisherDependencyProvider extends SprykerPublisherDependencyProvider
{
/**
* @return array
*/
protected function getPublisherPlugins(): array
{
return array_merge(
$this->getCategoryPageSearchPlugins(),
);
}
/**
* @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface[]
*/
protected function getCategoryPageSearchPlugins(): array
{
return [
new CategoryStoreSearchWritePublisherPlugin(),
new CategoryStoreSearchWriteForPublishingPublisherPlugin(),
new CategoryPageSearchCategoryDeletePublisherPlugin(),
new CategoryPageSearchCategoryWritePublisherPlugin(),
new CategoryPageSearchCategoryAttributeDeletePublisherPlugin(),
new CategoryPageSearchCategoryAttributeWritePublisherPlugin(),
new CategoryPageSearchCategoryNodeDeletePublisherPlugin(),
new CategoryPageSearchCategoryNodeWritePublisherPlugin(),
new CategoryPageSearchCategoryTemplateDeletePublisherPlugin(),
new CategoryPageSearchCategoryTemplateWritePublisherPlugin(),
];
}
/**
* @return \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherTriggerPluginInterface[]
*/
protected function getPublisherTriggerPlugins(): array
{
return [
new CategoryPagePublisherTriggerPlugin(),
];
}
}
-
From
Pyz\Zed\Synchronization\SynchronizationDependencyProvider
, remove the deprecated plugin:CategoryPageSynchronizationDataPlugin
. -
Add the new synchronization plugin to
Pyz\Zed\Synchronization\SynchronizationDependencyProvider
:
<?php
namespace Pyz\Zed\Synchronization;
use Spryker\Zed\CategoryPageSearch\Communication\Plugin\Synchronization\CategoryPageSynchronizationDataBulkRepositoryPlugin;
use Spryker\Zed\Synchronization\SynchronizationDependencyProvider as SprykerSynchronizationDependencyProvider;
class SynchronizationDependencyProvider extends SprykerSynchronizationDependencyProvider
{
/**
* @return \Spryker\Zed\SynchronizationExtension\Dependency\Plugin\SynchronizationDataPluginInterface[]
*/
protected function getSynchronizationDataPlugins(): array
{
return [
new CategoryPageSynchronizationDataBulkRepositoryPlugin(),
];
}
}
-
Refill storage:
- Truncate the
spy_category_node_page_search
database table:
TRUNCATE TABLE spy_category_node_page_search;
- Remove all the data:
console sync:data category_node
- Trigger the event:
console publish:trigger-events -r category_node
- Sync all table storage data to the storage:
console sync:data category_node
- Truncate the
Ensure that the data in the spy_category_node_page_search
database table is divided by stores.
Upgrading from Version 1.4.* to Version 1.5.*
This migration guide is a part of the Search migration effort. Prior to upgarding this module, make sure you have completed all the steps from the Search Migration Guide.
To upgrade to the new version of the module, do the following:
- Update the modules using Composer:
composer update spryker/category-page-search
- Remove deprecated plugin usages listed below (in case it is used) from
Pyz\Zed\Search\SearchDependencyProvider
:
Spryker\Zed\CategoryPageSearch\Communication\Plugin\Search\CategoryNodeDataPageMapBuilder
Thank you!
For submitting the form