Commit 7a0a413b authored by Giorgos Adam's avatar Giorgos Adam

Injecting directly the AreaList and identifying if translation loading is needed

parent 35d88798
......@@ -26,7 +26,9 @@ namespace Adyen\Payment\Model;
use Magento\Framework\Webapi\Exception;
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
use Magento\Framework\App\Area;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\App\AreaList;
use Magento\Framework\Phrase\Renderer\Placeholder;
use Magento\Framework\Phrase;
class Cron
{
......@@ -165,9 +167,9 @@ class Cron
protected $_adyenOrderPaymentCollectionFactory;
/**
* @var ObjectManagerInterface
* @var AreaList
*/
protected $_objectManager;
protected $_areaList;
/**
* Cron constructor.
......@@ -184,7 +186,7 @@ class Cron
* @param Api\PaymentRequest $paymentRequest
* @param Order\PaymentFactory $adyenOrderPaymentFactory
* @param Resource\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory
* @param ObjectManagerInterface $objectManager
* @param AreaList $areaList
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
......@@ -199,7 +201,7 @@ class Cron
\Adyen\Payment\Model\Api\PaymentRequest $paymentRequest,
\Adyen\Payment\Model\Order\PaymentFactory $adyenOrderPaymentFactory,
\Adyen\Payment\Model\Resource\Order\Payment\CollectionFactory $adyenOrderPaymentCollectionFactory,
ObjectManagerInterface $objectManager
AreaList $areaList
) {
$this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger;
......@@ -213,7 +215,7 @@ class Cron
$this->_adyenPaymentRequest = $paymentRequest;
$this->_adyenOrderPaymentFactory = $adyenOrderPaymentFactory;
$this->_adyenOrderPaymentCollectionFactory = $adyenOrderPaymentCollectionFactory;
$this->_objectManager = $objectManager;
$this->_areaList = $areaList;
}
/**
......@@ -223,9 +225,9 @@ class Cron
public function processNotification()
{
// needed for Magento < 2.2.0 https://github.com/magento/magento2/pull/8413
$areaList = $this->_objectManager->get(\Magento\Framework\App\AreaList::class);
if($areaList) {
$areaList->getArea(Area::AREA_CRONTAB)->load(Area::PART_TRANSLATE);
$renderer = Phrase::getRenderer();
if($renderer instanceof Placeholder) {
$this->_areaList->getArea(Area::AREA_CRONTAB)->load(Area::PART_TRANSLATE);
}
$this->_order = null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment