From 925b44ccb354032774695f62f9cefe0ed71e570d Mon Sep 17 00:00:00 2001 From: Rodion Kachkin Date: Thu, 16 May 2024 11:55:47 +0400 Subject: [PATCH] Fix errors CI: undefined \Magento\Framework\Controller\ResultFactory: (#96) Co-authored-by: Rodion Kachkin --- Controller/Adminhtml/Cheque/MassResend.php | 19 +++++++++---------- Controller/Frontend/Callback.php | 22 +++++++++------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Controller/Adminhtml/Cheque/MassResend.php b/Controller/Adminhtml/Cheque/MassResend.php index 8f4145d..2f74ef0 100644 --- a/Controller/Adminhtml/Cheque/MassResend.php +++ b/Controller/Adminhtml/Cheque/MassResend.php @@ -12,7 +12,7 @@ use Magento\Backend\App\Action\Context; use Magento\Backend\Model\View\Result\Redirect; use Magento\Framework\App\Action\HttpPostActionInterface; -use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Controller\Result\RedirectFactory; use Magento\Ui\Component\MassAction\Filter; use Mygento\Kkm\Api\Data\TransactionAttemptInterface; use Mygento\Kkm\Api\ResenderInterface; @@ -24,6 +24,11 @@ class MassResend extends Action implements HttpPostActionInterface { public const ADMIN_RESOURCE = 'Mygento_Kkm::cheque_resend'; + /** + * @var RedirectFactory + */ + private $redirectResultFactory; + /** * @var Filter */ @@ -49,16 +54,9 @@ class MassResend extends Action implements HttpPostActionInterface */ private $resender; - /** - * @param Context $context - * @param Filter $filter - * @param CollectionFactory $collectionFactory - * @param TransactionAttempt $transactionAttemptHelper - * @param Data $configHelper - * @param ResenderInterface $resender - */ public function __construct( Context $context, + RedirectFactory $redirectResultFactory, Filter $filter, CollectionFactory $collectionFactory, TransactionAttempt $transactionAttemptHelper, @@ -67,6 +65,7 @@ public function __construct( ) { parent::__construct($context); + $this->redirectResultFactory = $redirectResultFactory; $this->filter = $filter; $this->collectionFactory = $collectionFactory; $this->transactionAttemptHelper = $transactionAttemptHelper; @@ -128,7 +127,7 @@ public function execute() ); } - $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); + $resultRedirect = $this->redirectResultFactory->create(); $redirectPath = $this->filter->getComponentRefererUrl() ?: 'kkm/transactionattempt/'; return $resultRedirect->setPath($redirectPath); diff --git a/Controller/Frontend/Callback.php b/Controller/Frontend/Callback.php index cce4acb..6041ec6 100644 --- a/Controller/Frontend/Callback.php +++ b/Controller/Frontend/Callback.php @@ -11,7 +11,6 @@ use Magento\Framework\App\CsrfAwareActionInterface; use Magento\Framework\App\Request\InvalidRequestException; use Magento\Framework\App\RequestInterface; -use Magento\Framework\Controller\ResultFactory; class Callback extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface { @@ -20,6 +19,11 @@ class Callback extends \Magento\Framework\App\Action\Action implements CsrfAware */ private $responseFactory; + /** + * @var \Magento\Framework\Controller\Result\RawFactory + */ + private $rawResultFactory; + /** * @var \Mygento\Kkm\Model\VendorInterface */ @@ -50,19 +54,9 @@ class Callback extends \Magento\Framework\App\Action\Action implements CsrfAware */ private $storeManager; - /** - * Callback constructor. - * @param \Mygento\Kkm\Model\Atol\ResponseFactory $responseFactory - * @param \Mygento\Kkm\Model\VendorInterface $vendor - * @param \Mygento\Kkm\Helper\Data $kkmHelper - * @param \Mygento\Kkm\Helper\Error $errorHelper - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Mygento\Kkm\Helper\Resell $resellHelper - * @param \Mygento\Kkm\Api\Processor\SendInterface $processor - * @param \Magento\Framework\App\Action\Context $context - */ public function __construct( \Mygento\Kkm\Model\Atol\ResponseFactory $responseFactory, + \Magento\Framework\Controller\Result\RawFactory $rawResultFactory, \Mygento\Kkm\Model\VendorInterface $vendor, \Mygento\Kkm\Helper\Data $kkmHelper, \Mygento\Kkm\Helper\Error $errorHelper, @@ -72,7 +66,9 @@ public function __construct( \Magento\Framework\App\Action\Context $context ) { parent::__construct($context); + $this->responseFactory = $responseFactory; + $this->rawResultFactory = $rawResultFactory; $this->vendor = $vendor; $this->kkmHelper = $kkmHelper; $this->storeManager = $storeManager; @@ -92,7 +88,7 @@ public function execute() $entity = null; //For testing purposes - $result = $this->resultFactory->create(ResultFactory::TYPE_RAW); + $result = $this->rawResultFactory->create(); try { $response = $this->responseFactory->create(['jsonRaw' => $json]);