Magento2:每个存储的配置数据值错误

Magento2:每个存储的配置数据值错误,magento2,Magento2,我正在尝试获取一些Magento2自定义core_config_数据值,如其他主题中所述,但我有一些与存储ID相关的错误值。我将尝试解释,让我们从一些相关代码开始: public function __construct( \Psr\Log\LoggerInterface $logger, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfi

我正在尝试获取一些Magento2自定义core_config_数据值,如其他主题中所述,但我有一些与存储ID相关的错误值。我将尝试解释,让我们从一些相关代码开始:

public function __construct(
  \Psr\Log\LoggerInterface $logger,
  \Magento\Store\Model\StoreManagerInterface $storeManager,
  \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) {..}

  {
    $store = $this->storeManager->getStore();
    $this->logger->debug($store->getId() . ": " . $store->getCode());
    $message = $this->scopeConfig->getValue(self::CONF_MESSAGE,
      \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
    $link = $this->scopeConfig->getValue(self::CONF_LINK,
      \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
这里发生的是存储ID存储代码正确的。 在我看到的日志中

main.DEBUG: 3: tedesco
我在
$message
$link
中获得的值是不正确的:它们是另一个存储的值(正确的存储ID应该是3,如调试日志所示,但该值是来自ID为1的存储的值)

当然,我已经检查了DB,其值很好,如图所示:

Magento 2.1.4

有什么提示吗


提前感谢。

如果将门店或门店id传递给第三个参数,会发生什么情况

$message = $this->scopeConfig->getValue(self::CONF_MESSAGE,
  \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);

非常感谢,$store(
$store=$this->storeManager->getStore();
)是我必须传递的参数。不客气,但我一直认为,如果不传递第三个参数,默认情况下必须获得当前存储。我还认为使用
SCOPE\u store
是一种说法“范围是存储,所以使用当前存储”。我非常确定我没有去检查
getValue()
函数代码,这是一个很大的错误…再次感谢