From 29a53747cafce35ce1595c775968c48270f0b2b0 Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Mon, 24 Jul 2023 15:12:57 +0200 Subject: [PATCH] Improve UPGRADE 2.0 --- UPGRADE-2.0.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index 0aa4a93c..e71c8050 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -87,3 +87,30 @@ imports: protected function createTranslation(): ProductOptionTranslationInterface { ``` + +6. The `Product` entity doesn't need to implement the `DocumentableInterface` anymore. You can remove it. + +7. The way to add some additionnal data changed. + +Before we should have this in your Product entity for example : + +```php + use DocumentableProductTrait { + convertToDocument as parentConvertToDocument; + } + + public function convertToDocument(string $locale): Result + { + $document = $this->parentConvertToDocument($locale); + + if ($this->getCustomValue()) { + $document->addAttribute('custom_value', 'Custom Value', [$this->getCustomValue()], $locale, 1); + } + + return $document; + } +``` + +Now please refer to the [Add custom value](docs/add_custom_values.md) documentation. + +@TODO - Templating part