-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1054 from romainruaud/fix_optimizer-json-backend
Store Optimizer config and rule condition as JSON.
- Loading branch information
Showing
5 changed files
with
112 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/module-elasticsuite-catalog-optimizer/Setup/UpgradeData.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCatalogOptimizer | ||
* @author Romain Ruaud <romain.ruaud@smile.fr> | ||
* @copyright 2018 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
namespace Smile\ElasticsuiteCatalogOptimizer\Setup; | ||
|
||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
|
||
/** | ||
* Upgrade Data for Smile Elasticsuite Optimizer module. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCatalogOptimizer | ||
* @author Romain Ruaud <romain.ruaud@smile.fr> | ||
*/ | ||
class UpgradeData implements \Magento\Framework\Setup\UpgradeDataInterface | ||
{ | ||
/** | ||
* @var OptimizerSetup | ||
*/ | ||
private $optimizerSetup; | ||
|
||
/** | ||
* InstallSchema constructor. | ||
* | ||
* @param \Smile\ElasticsuiteCatalogOptimizer\Setup\OptimizerSetupFactory $optimizerSetupFactory Setup Factory | ||
*/ | ||
public function __construct(OptimizerSetupFactory $optimizerSetupFactory) | ||
{ | ||
$this->optimizerSetup = $optimizerSetupFactory->create(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$setup->startSetup(); | ||
if (version_compare($context->getVersion(), "1.2.0") < 0) { | ||
$this->optimizerSetup->convertSerializedRulesToJson($setup); | ||
} | ||
$setup->endSetup(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters