Upgrade the CmsBlockStorage module
Edit on GitHubUpgrading from version 1.* to version 2.*
CmsBlockStorage
version 2.0.0 introduces the following backward incompatible changes:
- Introduced the
spy_cms_block_storage.cms_block_key
field to store thecms_block
identifier. - Introduced the
mappings
parameter to synchronization behavior to support the ability to get data by block names. - Increased the minimum
spryker/cms-block
version incomposer.json
. See Upgrade the CmsBlock module for more details. - Removed
CmsBlockStorageClient::findBlockNamesByOptions()
. - Removed
CmsBlockStorageClientInterface::generateBlockNameKey()
. - Added return type as an array to
CmsBlockStorageClientInterface::findBlocksByNames()
.
Estimated migration time: 1h
-
Upgrade to the new module version:
- Upgrade the
CmsBlockStorage
module to version 2.0.0:
composer require spryker/cms-block-storage:"^2.0.0" --update-with-dependencies
- Upgrade the
-
Clear storage:
- Truncate the
spy_cms_block_storage
database table:
TRUNCATE TABLE spy_cms_block_storage
- Remove all keys from Redis:
redis-cli --scan --pattern kv:cms_block:'*' | xargs redis-cli unlink
- Truncate the
-
Update the database schema and generate classes:
- Run the database migration:
console propel:install
- Generate transfer objects:
console transfer:generate
-
Populate storage with the new version:
- Get all the data about CMS blocks from database and publish it into Redis:
console event:trigger -r cms_block
-
Verify that the
spy_cms_block_storage.key
column uses keys instead of IDs. For example,cms_block:en_us:blck-1
, whereblck-1
is the CMS block key. -
Verify that all the method overrides in
\Pyz\Zed\CmsBlockStorage\CmsBlockStorageDependencyProvider
match the signature provided in the package:
protected function getContentWidgetDataExpanderPlugins(): array
-
Enable CMS Block Key support for categories and products (optional):
- Install CMS block key support for
CmsBlockCategoryStorage
andCmsBlockProductStorage
modules:
composer require spryker/cms-block-category-storage:"^1.4.0" spryker/cms-block-product-storage:"^1.4.0" --update-with-dependencies
- Add plugins in
src/Pyz/Client/CmsBlockStorage/CmsBlockStorageDependencyProvider.php
:
namespace Pyz\Client\CmsBlockStorage; use Spryker\Client\CmsBlockCategoryStorage\Plugin\CmsBlockStorage\CmsBlockCategoryCmsBlockStorageReaderPlugin; use Spryker\Client\CmsBlockProductStorage\Plugin\CmsBlockStorage\CmsBlockProductCmsBlockStorageReaderPlugin; use Spryker\Client\CmsBlockStorage\CmsBlockStorageDependencyProvider as SprykerCmsBlockStorageDependencyProvider; class CmsBlockStorageDependencyProvider extends SprykerCmsBlockStorageDependencyProvider { /** * @return \Spryker\Client\CmsBlockStorageExtension\Dependency\Plugin\CmsBlockStorageReaderPluginInterface[] */ protected function getCmsBlockStorageReaderPlugins(): array { return [ new CmsBlockCategoryCmsBlockStorageReaderPlugin(), new CmsBlockProductCmsBlockStorageReaderPlugin(), ]; } }
- Trigger sync events:
console event:trigger -r cms_block_category console event:trigger -r cms_block_product
- Install CMS block key support for
Thank you!
For submitting the form