Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "area code is not set" in all commands that depend on Payment/Helper/Data #33726

Merged
merged 10 commits into from
Oct 28, 2021
10 changes: 4 additions & 6 deletions app/code/Magento/Payment/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
protected $_paymentConfig;

/**
* Layout
*
* @var \Magento\Framework\View\LayoutInterface
* @var \Magento\Framework\View\LayoutFactory
*/
protected $_layout;
protected $_layoutFactory;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't rename exist properties in @api class. It's backward incompatible.
Just add another one private property and deprecate current

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍🏼


/**
* Factory for payment method models
Expand Down Expand Up @@ -76,7 +74,7 @@ public function __construct(
\Magento\Framework\App\Config\Initial $initialConfig
) {
parent::__construct($context);
$this->_layout = $layoutFactory->create();
$this->_layoutFactory = $_layoutFactory;
$this->_methodFactory = $paymentMethodFactory;
$this->_appEmulation = $appEmulation;
$this->_paymentConfig = $paymentConfig;
Expand Down Expand Up @@ -183,7 +181,7 @@ public function getMethodFormBlock(MethodInterface $method, LayoutInterface $lay
*/
public function getInfoBlock(InfoInterface $info, LayoutInterface $layout = null)
{
$layout = $layout ?: $this->_layout;
$layout = $layout ?: $this->_layoutFactory->create();
$blockType = $info->getMethodInstance()->getInfoBlockType();
$block = $layout->createBlock($blockType);
$block->setInfo($info);
Expand Down