diff --git a/CHANGELOG.md b/CHANGELOG.md index 285bfef..52f3260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Digital Products +## Unreleased + +- Fixed a bug where product fields content was not prepared for Craft 5. + ## 4.0.0 - 2024-03-20 - Digital Products now requires Craft Commerce 5.0.0-beta.1 or later. diff --git a/src/Plugin.php b/src/Plugin.php index 7d661f8..cd88f9d 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -69,7 +69,7 @@ class Plugin extends BasePlugin /** * @inheritDoc */ - public string $schemaVersion = '3.0.3'; + public string $schemaVersion = '4.0.0.1'; /** * @inheritDoc diff --git a/src/migrations/m240620_150738_content_refactor_elements.php b/src/migrations/m240620_150738_content_refactor_elements.php new file mode 100644 index 0000000..9883bbe --- /dev/null +++ b/src/migrations/m240620_150738_content_refactor_elements.php @@ -0,0 +1,39 @@ +getProductTypes()->getAllProductTypes() as $productType) { + $this->updateElements( + (new Query())->from(Table::PRODUCTS)->where(['typeId' => $productType->id]), + $productType->getProductFieldLayout() + ); + } + + return true; + } + + /** + * @inheritdoc + */ + public function safeDown(): bool + { + echo "m240620_150738_content_refactor_elements cannot be reverted.\n"; + return false; + } +}