Skip to content

Commit 8acab0f

Browse files
committed
updated logic to fetch magento edition
1 parent 164e57a commit 8acab0f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

app/code/Meta/BusinessExtension/Helper/FBEHelper.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Magento\Framework\App\Helper\AbstractHelper;
2525
use Magento\Framework\App\Helper\Context;
2626
use Magento\Framework\App\ProductMetadataInterface;
27+
use Magento\Framework\App\ProductMetadata as FrameworkProductMetaData;
2728
use Magento\Framework\App\ResourceConnection;
2829
use Magento\Framework\HTTP\Client\Curl;
2930
use Magento\Framework\Module\ModuleListInterface;
@@ -90,6 +91,11 @@ class FBEHelper extends AbstractHelper
9091
*/
9192
private $systemConfig;
9293

94+
/**
95+
* @var ProductMetadataInterface
96+
*/
97+
private $productMetadata;
98+
9399
/**
94100
* FBEHelper constructor
95101
*
@@ -101,6 +107,7 @@ class FBEHelper extends AbstractHelper
101107
* @param ResourceConnection $resourceConnection
102108
* @param ModuleListInterface $moduleList
103109
* @param SystemConfig $systemConfig
110+
* @param ProductMetadataInterface $productMetadata
104111
*/
105112
public function __construct(
106113
Context $context,
@@ -110,7 +117,8 @@ public function __construct(
110117
Curl $curl,
111118
ResourceConnection $resourceConnection,
112119
ModuleListInterface $moduleList,
113-
SystemConfig $systemConfig
120+
SystemConfig $systemConfig,
121+
ProductMetadataInterface $productMetadata
114122
) {
115123
parent::__construct($context);
116124
$this->objectManager = $objectManager;
@@ -120,16 +128,17 @@ public function __construct(
120128
$this->resourceConnection = $resourceConnection;
121129
$this->moduleList = $moduleList;
122130
$this->systemConfig = $systemConfig;
131+
$this->productMetadata = $productMetadata;
123132
}
124133

125134
/**
126135
* Get magento version
127136
*
128-
* @return mixed
137+
* @return string
129138
*/
130-
public function getMagentoVersion()
139+
public function getMagentoVersion(): string
131140
{
132-
return $this->objectManager->get(ProductMetadataInterface::class)->getVersion();
141+
return $this->productMetadata->getVersion();
133142
}
134143

135144
/**
@@ -147,9 +156,9 @@ public function getPluginVersion()
147156
*
148157
* @return string
149158
*/
150-
public function getSource()
159+
public function getSource(): string
151160
{
152-
return 'magento2';
161+
return $this->productMetadata->getEdition() == FrameworkProductMetaData::EDITION_NAME ? 'magento_opensource' : 'adobe_commerce';
153162
}
154163

155164
/**

0 commit comments

Comments
 (0)