diff --git a/README.md b/README.md index 2ab033c..b90981c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Please find some installation advices below and more information on [https://www ### Prerequisites -Recolize Recommendation Engine is fully compatible with Magento versions starting from 2.1 (Community/Open Source and Enterprise/Commerce Editions). +Recolize Recommendation Engine is fully compatible with Magento versions starting from 2.3 (Community/Open Source and Enterprise/Commerce Editions). Please note that the [Magento cronjob](https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-cron.html) should be set up correctly to use all features of this extension without any limitations. diff --git a/Setup/InstallData.php b/Setup/Patch/Data/GenerateFeedPatch.php similarity index 61% rename from Setup/InstallData.php rename to Setup/Patch/Data/GenerateFeedPatch.php index bda972d..a37fe4f 100644 --- a/Setup/InstallData.php +++ b/Setup/Patch/Data/GenerateFeedPatch.php @@ -12,64 +12,76 @@ * @license http://opensource.org/licenses/GPL-3.0 GNU General Public License Version 3 (GPLv3). */ -namespace Recolize\RecommendationEngine\Setup; +namespace Recolize\RecommendationEngine\Setup\Patch\Data; -use Magento\Framework\Setup\InstallDataInterface; -use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; +use Magento\Framework\Setup\Patch\DataPatchInterface; -class InstallData implements InstallDataInterface +class GenerateFeedPatch implements DataPatchInterface { - /** - * @var \Recolize\RecommendationEngine\Model\Feed - */ + /** @var ModuleDataSetupInterface */ + private $moduleDataSetup; + + /** @var \Recolize\RecommendationEngine\Model\Feed */ private $feed; - /** - * @var \Magento\Framework\App\State - */ + /** @var \Magento\Framework\App\State */ private $appState; - /** - * @var \Psr\Log\LoggerInterface - */ + /** @var \Psr\Log\LoggerInterface */ private $logger; - /** - * @param \Recolize\RecommendationEngine\Model\Feed $feed - * @param \Magento\Framework\App\State $appState - * @param \Psr\Log\LoggerInterface $logger - */ public function __construct( + ModuleDataSetupInterface $moduleDataSetup, \Recolize\RecommendationEngine\Model\Feed $feed, \Magento\Framework\App\State $appState, \Psr\Log\LoggerInterface $logger ) { + $this->moduleDataSetup = $moduleDataSetup; $this->feed = $feed; $this->appState = $appState; $this->logger = $logger; } /** - * @param \Magento\Framework\Setup\ModuleDataSetupInterface $setup - * @param \Magento\Framework\Setup\ModuleContextInterface $context + * @inheritdoc */ - public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + public function apply() { + $this->moduleDataSetup->getConnection()->startSetup(); + try { // We use emulateAreaCode() method here to ensure clean reset after finish and to not interact with other // setup scripts as setAreaCode() can only be called once. $this->appState->emulateAreaCode( \Magento\Framework\App\Area::AREA_FRONTEND, - array($this, 'generateFeed') + [$this, 'generateFeed'] ); } catch (\Exception $exception) { $this->logger->critical($exception->getMessage()); } + + $this->moduleDataSetup->getConnection()->endSetup(); + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return []; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; } /** - * @return array + * @return array|string[] */ public function generateFeed() { diff --git a/composer.json b/composer.json index 3e4ec56..5d68bbf 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "recolize/module-recommendation-engine-magento2", "description": "The Recolize Recommendation Engine as extension for Magento 2", - "version": "1.0.11", + "version": "1.1.0", "type": "magento2-module", "keywords": [ "recolize", @@ -22,7 +22,7 @@ "email": "service@recolize.com" }, "require": { - "php": "^5.6|^7", + "php": "^7|^8.0", "magento/framework": ">=100.1.3", "magento/module-import-export": ">=100.1.3" }, @@ -36,14 +36,14 @@ }, "require-dev": { "roave/security-advisories": "dev-latest", - "magento/magento-coding-standard": "^15.0" + "magento/magento-coding-standard": "*" }, "scripts": { "post-install-cmd": [ - "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)" + "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/,vendor/phpcompatibility/php-compatibility)" ], "post-update-cmd": [ - "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)" + "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/,vendor/phpcompatibility/php-compatibility)" ] }, "repositories": [ @@ -52,4 +52,4 @@ "url": "https://repo.magento.com/" } ] -} \ No newline at end of file +} diff --git a/etc/module.xml b/etc/module.xml index 5653533..d928d2e 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - +