How to pass custom parameters to parent construct?I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Magento 2 Custom Module New Controller IssueHow to override core class which is already overrided by other custom module in Magento 2main.CRITICAL: Plugin class doesn't exist__construct() argument error when overriding 2 custom modules from same core moduleMagento 2 admin form controller errorMagento 2.2.0 - __construct() must be an instance of MagentoFrameworkViewResultPageFactory,Magento 2.3 Can't view module's front end page output?Unable to Serialize Value Magento 2.2.6Unable to serialize value problem with Magento 2.2.6
How can I determine if the org that I'm currently connected to is a scratch org?
Cursor Replacement for Newbies
How badly should I try to prevent a user from XSSing themselves?
Expand and Contract
Size of subfigure fitting its content (tikzpicture)
Intersection Puzzle
Should I tell management that I intend to leave due to bad software development practices?
What exploit Are these user agents trying to use?
How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?
Personal Teleportation: From Rags to Riches
Watching something be piped to a file live with tail
What is a romance in Latin?
Can I run a new neutral wire to repair a broken circuit?
Short story with a alien planet, government officials must wear exploding medallions
What method can I use to design a dungeon difficult enough that the PCs can't make it through without killing them?
Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
Can we compute the area of a quadrilateral with one right angle when we only know the lengths of any three sides?
How do conventional missiles fly?
Why would the Red Woman birth a shadow if she worshipped the Lord of the Light?
How to Recreate this in LaTeX? (Unsure What the Notation is Called)
Avoiding the "not like other girls" trope?
Is there a hemisphere-neutral way of specifying a season?
Is "remove commented out code" correct English?
How to pass custom parameters to parent construct?
I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Magento 2 Custom Module New Controller IssueHow to override core class which is already overrided by other custom module in Magento 2main.CRITICAL: Plugin class doesn't exist__construct() argument error when overriding 2 custom modules from same core moduleMagento 2 admin form controller errorMagento 2.2.0 - __construct() must be an instance of MagentoFrameworkViewResultPageFactory,Magento 2.3 Can't view module's front end page output?Unable to Serialize Value Magento 2.2.6Unable to serialize value problem with Magento 2.2.6
I have extended MagentoSalesControllerAdminhtmlOrder
to Custom class like below,but not able pass one more parameter($httpClientFactory
) to this construct level.
How to pass custom parameters($httpClientFactory
) to parent construct?
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
**MagentoFrameworkHTTPZendClientFactory $httpClientFactory**
)
$this->layoutFactory = $layoutFactory;
**$this->_httpClientFactory = $httpClientFactory;**
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
magento2 construct
|
show 5 more comments
I have extended MagentoSalesControllerAdminhtmlOrder
to Custom class like below,but not able pass one more parameter($httpClientFactory
) to this construct level.
How to pass custom parameters($httpClientFactory
) to parent construct?
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
**MagentoFrameworkHTTPZendClientFactory $httpClientFactory**
)
$this->layoutFactory = $layoutFactory;
**$this->_httpClientFactory = $httpClientFactory;**
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
magento2 construct
you have to define_httpClientFactory
before your constructor
– magefms
21 hours ago
likeprotected $_httpClientFactory
– magefms
21 hours ago
I have defined also like protected $_httpClientFactory , but it is not working
– Vamsy Krishna
20 hours ago
what error did you get?
– magefms
20 hours ago
why do you need this_httpClientFactory
?
– magefms
20 hours ago
|
show 5 more comments
I have extended MagentoSalesControllerAdminhtmlOrder
to Custom class like below,but not able pass one more parameter($httpClientFactory
) to this construct level.
How to pass custom parameters($httpClientFactory
) to parent construct?
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
**MagentoFrameworkHTTPZendClientFactory $httpClientFactory**
)
$this->layoutFactory = $layoutFactory;
**$this->_httpClientFactory = $httpClientFactory;**
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
magento2 construct
I have extended MagentoSalesControllerAdminhtmlOrder
to Custom class like below,but not able pass one more parameter($httpClientFactory
) to this construct level.
How to pass custom parameters($httpClientFactory
) to parent construct?
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
**MagentoFrameworkHTTPZendClientFactory $httpClientFactory**
)
$this->layoutFactory = $layoutFactory;
**$this->_httpClientFactory = $httpClientFactory;**
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
magento2 construct
magento2 construct
edited 20 hours ago
ABHISHEK TRIPATHI
2,0611728
2,0611728
asked 21 hours ago
Vamsy KrishnaVamsy Krishna
111
111
you have to define_httpClientFactory
before your constructor
– magefms
21 hours ago
likeprotected $_httpClientFactory
– magefms
21 hours ago
I have defined also like protected $_httpClientFactory , but it is not working
– Vamsy Krishna
20 hours ago
what error did you get?
– magefms
20 hours ago
why do you need this_httpClientFactory
?
– magefms
20 hours ago
|
show 5 more comments
you have to define_httpClientFactory
before your constructor
– magefms
21 hours ago
likeprotected $_httpClientFactory
– magefms
21 hours ago
I have defined also like protected $_httpClientFactory , but it is not working
– Vamsy Krishna
20 hours ago
what error did you get?
– magefms
20 hours ago
why do you need this_httpClientFactory
?
– magefms
20 hours ago
you have to define
_httpClientFactory
before your constructor– magefms
21 hours ago
you have to define
_httpClientFactory
before your constructor– magefms
21 hours ago
like
protected $_httpClientFactory
– magefms
21 hours ago
like
protected $_httpClientFactory
– magefms
21 hours ago
I have defined also like protected $_httpClientFactory , but it is not working
– Vamsy Krishna
20 hours ago
I have defined also like protected $_httpClientFactory , but it is not working
– Vamsy Krishna
20 hours ago
what error did you get?
– magefms
20 hours ago
what error did you get?
– magefms
20 hours ago
why do you need this
_httpClientFactory
?– magefms
20 hours ago
why do you need this
_httpClientFactory
?– magefms
20 hours ago
|
show 5 more comments
2 Answers
2
active
oldest
votes
You can try like this
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @var MagentoFrameworkHTTPZendClientFactory
*/
protected $_httpClientFactory;
/**
* @var MagentoFrameworkObjectManagerInterface
*/
protected $_objectManager;
/**
* Custom constructor.
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
* @param MagentoFrameworkHTTPZendClientFactory $httpClientFactory
* @param MagentoFrameworkObjectManagerInterface $objectmanager
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
$this->_objectManager = $objectmanager;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
public function execute()
//you execute logic here
getting error like A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.
– Vamsy Krishna
16 hours ago
not able to add/ override constructor properly
– Vamsy Krishna
15 hours ago
add a comment |
I think you are forgetting to add use statement for certain classes like
ActionContext $context,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository
etc. Also, I'm not able to see any namespace for your class.
Your file should look like below.
<?php
namespace [Vendors][Module]ControllerAdminhtml;
use MagentoBackendAppAction;
use MagentoSalesApiOrderManagementInterface;
use MagentoSalesApiOrderRepositoryInterface;
use MagentoFrameworkExceptionNoSuchEntityException;
use MagentoFrameworkExceptionInputException;
use PsrLogLoggerInterface;
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
Try this. After making changes clear generated folder and flush cache. It may work for you.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268455%2fhow-to-pass-custom-parameters-to-parent-construct%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can try like this
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @var MagentoFrameworkHTTPZendClientFactory
*/
protected $_httpClientFactory;
/**
* @var MagentoFrameworkObjectManagerInterface
*/
protected $_objectManager;
/**
* Custom constructor.
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
* @param MagentoFrameworkHTTPZendClientFactory $httpClientFactory
* @param MagentoFrameworkObjectManagerInterface $objectmanager
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
$this->_objectManager = $objectmanager;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
public function execute()
//you execute logic here
getting error like A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.
– Vamsy Krishna
16 hours ago
not able to add/ override constructor properly
– Vamsy Krishna
15 hours ago
add a comment |
You can try like this
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @var MagentoFrameworkHTTPZendClientFactory
*/
protected $_httpClientFactory;
/**
* @var MagentoFrameworkObjectManagerInterface
*/
protected $_objectManager;
/**
* Custom constructor.
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
* @param MagentoFrameworkHTTPZendClientFactory $httpClientFactory
* @param MagentoFrameworkObjectManagerInterface $objectmanager
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
$this->_objectManager = $objectmanager;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
public function execute()
//you execute logic here
getting error like A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.
– Vamsy Krishna
16 hours ago
not able to add/ override constructor properly
– Vamsy Krishna
15 hours ago
add a comment |
You can try like this
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @var MagentoFrameworkHTTPZendClientFactory
*/
protected $_httpClientFactory;
/**
* @var MagentoFrameworkObjectManagerInterface
*/
protected $_objectManager;
/**
* Custom constructor.
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
* @param MagentoFrameworkHTTPZendClientFactory $httpClientFactory
* @param MagentoFrameworkObjectManagerInterface $objectmanager
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
$this->_objectManager = $objectmanager;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
public function execute()
//you execute logic here
You can try like this
<?php
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @var MagentoFrameworkHTTPZendClientFactory
*/
protected $_httpClientFactory;
/**
* @var MagentoFrameworkObjectManagerInterface
*/
protected $_objectManager;
/**
* Custom constructor.
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
* @param MagentoFrameworkHTTPZendClientFactory $httpClientFactory
* @param MagentoFrameworkObjectManagerInterface $objectmanager
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
$this->_objectManager = $objectmanager;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
public function execute()
//you execute logic here
answered 17 hours ago
magefmsmagefms
2,3052426
2,3052426
getting error like A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.
– Vamsy Krishna
16 hours ago
not able to add/ override constructor properly
– Vamsy Krishna
15 hours ago
add a comment |
getting error like A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.
– Vamsy Krishna
16 hours ago
not able to add/ override constructor properly
– Vamsy Krishna
15 hours ago
getting error like A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.
– Vamsy Krishna
16 hours ago
getting error like A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.
– Vamsy Krishna
16 hours ago
not able to add/ override constructor properly
– Vamsy Krishna
15 hours ago
not able to add/ override constructor properly
– Vamsy Krishna
15 hours ago
add a comment |
I think you are forgetting to add use statement for certain classes like
ActionContext $context,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository
etc. Also, I'm not able to see any namespace for your class.
Your file should look like below.
<?php
namespace [Vendors][Module]ControllerAdminhtml;
use MagentoBackendAppAction;
use MagentoSalesApiOrderManagementInterface;
use MagentoSalesApiOrderRepositoryInterface;
use MagentoFrameworkExceptionNoSuchEntityException;
use MagentoFrameworkExceptionInputException;
use PsrLogLoggerInterface;
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
Try this. After making changes clear generated folder and flush cache. It may work for you.
add a comment |
I think you are forgetting to add use statement for certain classes like
ActionContext $context,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository
etc. Also, I'm not able to see any namespace for your class.
Your file should look like below.
<?php
namespace [Vendors][Module]ControllerAdminhtml;
use MagentoBackendAppAction;
use MagentoSalesApiOrderManagementInterface;
use MagentoSalesApiOrderRepositoryInterface;
use MagentoFrameworkExceptionNoSuchEntityException;
use MagentoFrameworkExceptionInputException;
use PsrLogLoggerInterface;
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
Try this. After making changes clear generated folder and flush cache. It may work for you.
add a comment |
I think you are forgetting to add use statement for certain classes like
ActionContext $context,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository
etc. Also, I'm not able to see any namespace for your class.
Your file should look like below.
<?php
namespace [Vendors][Module]ControllerAdminhtml;
use MagentoBackendAppAction;
use MagentoSalesApiOrderManagementInterface;
use MagentoSalesApiOrderRepositoryInterface;
use MagentoFrameworkExceptionNoSuchEntityException;
use MagentoFrameworkExceptionInputException;
use PsrLogLoggerInterface;
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
Try this. After making changes clear generated folder and flush cache. It may work for you.
I think you are forgetting to add use statement for certain classes like
ActionContext $context,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository
etc. Also, I'm not able to see any namespace for your class.
Your file should look like below.
<?php
namespace [Vendors][Module]ControllerAdminhtml;
use MagentoBackendAppAction;
use MagentoSalesApiOrderManagementInterface;
use MagentoSalesApiOrderRepositoryInterface;
use MagentoFrameworkExceptionNoSuchEntityException;
use MagentoFrameworkExceptionInputException;
use PsrLogLoggerInterface;
class Custom extends MagentoSalesControllerAdminhtmlOrder
/**
* @var MagentoFrameworkViewLayoutFactory
*/
protected $layoutFactory;
/**
* @param ActionContext $context
* @param MagentoFrameworkRegistry $coreRegistry
* @param MagentoFrameworkAppResponseHttpFileFactory $fileFactory
* @param MagentoFrameworkTranslateInlineInterface $translateInline
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory
* @param MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
* @param MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory
* @param MagentoFrameworkControllerResultRawFactory $resultRawFactory
* @param OrderManagementInterface $orderManagement
* @param OrderRepositoryInterface $orderRepository
* @param LoggerInterface $logger
* @param MagentoFrameworkViewLayoutFactory $layoutFactory
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function __construct(
ActionContext $context,
MagentoFrameworkRegistry $coreRegistry,
MagentoFrameworkAppResponseHttpFileFactory $fileFactory,
MagentoFrameworkTranslateInlineInterface $translateInline,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkViewResultLayoutFactory $resultLayoutFactory,
MagentoFrameworkControllerResultRawFactory $resultRawFactory,
OrderManagementInterface $orderManagement,
OrderRepositoryInterface $orderRepository,
LoggerInterface $logger,
MagentoFrameworkViewLayoutFactory $layoutFactory,
MagentoFrameworkHTTPZendClientFactory $httpClientFactory
)
$this->layoutFactory = $layoutFactory;
$this->_httpClientFactory = $httpClientFactory;
parent::__construct(
$context,
$coreRegistry,
$fileFactory,
$translateInline,
$resultPageFactory,
$resultJsonFactory,
$resultLayoutFactory,
$resultRawFactory,
$orderManagement,
$orderRepository,
$logger
);
Try this. After making changes clear generated folder and flush cache. It may work for you.
edited 9 hours ago
Ansuman
486
486
answered 10 hours ago
Yash ShahYash Shah
68618
68618
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268455%2fhow-to-pass-custom-parameters-to-parent-construct%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you have to define
_httpClientFactory
before your constructor– magefms
21 hours ago
like
protected $_httpClientFactory
– magefms
21 hours ago
I have defined also like protected $_httpClientFactory , but it is not working
– Vamsy Krishna
20 hours ago
what error did you get?
– magefms
20 hours ago
why do you need this
_httpClientFactory
?– magefms
20 hours ago