Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ma4nn committed Mar 11, 2022
2 parents f9d373f + a7f69df commit 45ab393
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
58 changes: 35 additions & 23 deletions Setup/InstallData.php → Setup/Patch/Data/GenerateFeedPatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -22,7 +22,7 @@
"email": "[email protected]"
},
"require": {
"php": "^5.6|^7",
"php": "^7|^8.0",
"magento/framework": ">=100.1.3",
"magento/module-import-export": ">=100.1.3"
},
Expand All @@ -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": [
Expand All @@ -52,4 +52,4 @@
"url": "https://repo.magento.com/"
}
]
}
}
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Recolize_RecommendationEngine" setup_version="1.0.11">
<module name="Recolize_RecommendationEngine" setup_version="1.1.0">
<sequence>
<module name="Magento_Backend"/>
</sequence>
Expand Down

0 comments on commit 45ab393

Please sign in to comment.